Skip to content

Commit

Permalink
Fix more restyled issues
Browse files Browse the repository at this point in the history
  • Loading branch information
bzbarsky-apple committed Jul 1, 2022
1 parent 40bc5b2 commit c3a4fc0
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ - (void)onPairingComplete:(NSError * _Nullable)error
} else {
MTRDeviceController * controller = InitializeCHIP();
uint64_t deviceId = CHIPGetLastPairedDeviceId();
if ([controller respondsToSelector:@selector(deviceBeingCommissionedOverBLE:)
if ([controller respondsToSelector:@selector(deviceBeingCommissionedOverBLE:)
&& [controller deviceBeingCommissionedOverBLE:deviceId]) {
dispatch_async(dispatch_get_main_queue(), ^{
[self->_deviceList refreshDeviceList];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,49 +219,47 @@ - (void)reportFromUserEnteredSettings
@"Sending temp reporting values: min %@ max %@ value %@", @(minIntervalSeconds), @(maxIntervalSeconds), @(deltaInCelsius));

if (CHIPGetConnectedDevice(^(MTRDevice * _Nullable chipDevice, NSError * _Nullable error) {
if (chipDevice) {
// Use a wildcard subscription
if (chipDevice) {
// Use a wildcard subscription
[chipDevice subscribeWithQueue:dispatch_get_main_queue()
minInterval:minIntervalSeconds
maxInterval:maxIntervalSeconds
params:nil
cacheContainer:nil
attributeReportHandler:^(NSArray * _Nullable reports) {
if ( !reports )
return;
for (MTRAttributeReport * report in reports) {
// These should be exposed by the SDK
if ([report.path.cluster isEqualToNumber:@(MTRClusterTemperatureMeasurementID)] &&
[report.path.attribute
isEqualToNumber:@(MTRClusterTemperatureMeasurementAttributeMeasuredValueID)]) {
if (report.error != nil) {
NSLog(@"Error reading temperature: %@", report.error);
} else {
__auto_type controller = [TemperatureSensorViewController currentController];
if (controller != nil) {
[controller updateTempInUI:((NSNumber *) report.value).shortValue];
}
}
}
}
if (!reports)
return;
for (MTRAttributeReport * report in reports) {
// These should be exposed by the SDK
if ([report.path.cluster isEqualToNumber:@(MTRClusterTemperatureMeasurementID)] &&
[report.path.attribute isEqualToNumber:@(MTRClusterTemperatureMeasurementAttributeMeasuredValueID)]) {
if (report.error != nil) {
NSLog(@"Error reading temperature: %@", report.error);
} else {
__auto_type controller = [TemperatureSensorViewController currentController];
if (controller != nil) {
[controller updateTempInUI:((NSNumber *) report.value).shortValue];
}
}
}
}
}
eventReportHandler:nil
errorHandler:^(NSError * error) {
NSLog(@"Status: update reportAttributeMeasuredValue completed with error %@",
[error description]);
NSLog(@"Status: update reportAttributeMeasuredValue completed with error %@", [error description]);
}
subscriptionEstablished:(nullable void (^)(void))subscriptionEstablishedHandler { if (error) {
NSLog(@"Status: update reportAttributeMeasuredValue completed");
}
subscriptionEstablished:(nullable void (^)(void))subscriptionEstablishedHandler {
if (error) {
NSLog(@"Status: update reportAttributeMeasuredValue completed");
}
];
} else {
NSLog(@"Status: Failed to establish a connection with the device");
}
})) {
NSLog(@"Status: Waiting for connection with the device");
} else {
NSLog(@"Status: Failed to trigger the connection with the device");
}
else { NSLog(@"Status: Failed to trigger the connection with the device"); }
}

@end

0 comments on commit c3a4fc0

Please sign in to comment.