Skip to content

Commit

Permalink
Address review comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
bzbarsky-apple committed Oct 28, 2022
1 parent 3d60aae commit cfa17ab
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/darwin/Framework/CHIP/MTRAttributeCacheContainer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ - (void)readAttributeWithEndpointId:(NSNumber * _Nullable)endpointId
getProxyHandleWithCompletion:^(dispatch_queue_t _Nonnull queue, MTRDeviceControllerXPCProxyHandle * _Nullable handle) {
if (handle) {
[handle.proxy readAttributeCacheWithController:controllerId
nodeId:[nodeId unsignedLongLongValue]
nodeId:nodeId.unsignedLongLongValue
endpointId:endpointId
clusterId:clusterId
attributeId:attributeId
Expand Down
2 changes: 1 addition & 1 deletion src/darwin/Framework/CHIP/MTRBaseDevice.mm
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ - (instancetype)initWithNodeID:(NSNumber *)nodeID controller:(MTRDeviceControlle
{
if (self = [super init]) {
_isPASEDevice = NO;
_nodeID = [nodeID unsignedLongLongValue];
_nodeID = nodeID.unsignedLongLongValue;
_deviceController = controller;
}
return self;
Expand Down
2 changes: 1 addition & 1 deletion src/darwin/Framework/CHIP/MTRControllerFactory.mm
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ - (BOOL)findMatchingFabric:(FabricTable &)fabricTable
}
}

*fabric = fabricTable.FindFabric(pubKey, [params.fabricID unsignedLongLongValue]);
*fabric = fabricTable.FindFabric(pubKey, params.fabricID.unsignedLongLongValue);
return YES;
}

Expand Down
4 changes: 2 additions & 2 deletions src/darwin/Framework/CHIP/MTRDevice.mm
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ - (void)subscribeWithMinInterval:(uint16_t)minInterval maxInterval:(uint16_t)max

_subscriptionActive = YES;

[_deviceController getSessionForNode:[_nodeID unsignedLongLongValue]
[_deviceController getSessionForNode:_nodeID.unsignedLongLongValue
completionHandler:^(chip::Messaging::ExchangeManager * _Nullable exchangeManager,
const chip::Optional<chip::SessionHandle> & session, NSError * _Nullable error) {
if (error != nil) {
Expand Down Expand Up @@ -745,7 +745,7 @@ @implementation MTRDevice (Deprecated)

+ (instancetype)deviceWithNodeID:(uint64_t)nodeID deviceController:(MTRDeviceController *)deviceController
{
return [MTRDevice deviceWithNodeID:@(nodeID) controller:deviceController];
return [self deviceWithNodeID:@(nodeID) controller:deviceController];
}

@end
Expand Down
10 changes: 5 additions & 5 deletions src/darwin/Framework/CHIP/MTRDeviceController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ - (BOOL)startup:(MTRDeviceControllerStartupParamsInternal *)startupParams
chip::MutableByteSpan noc(nocBuffer);

if (commissionerParams.operationalKeypair != nullptr) {
errorCode = _operationalCredentialsDelegate->GenerateNOC([startupParams.nodeId unsignedLongLongValue],
[startupParams.fabricID unsignedLongLongValue], chip::kUndefinedCATs,
errorCode = _operationalCredentialsDelegate->GenerateNOC(startupParams.nodeId.unsignedLongLongValue,
startupParams.fabricID.unsignedLongLongValue, chip::kUndefinedCATs,
commissionerParams.operationalKeypair->Pubkey(), noc);

if ([self checkForStartError:errorCode logMsg:kErrorGenerateNOC]) {
Expand All @@ -300,8 +300,8 @@ - (BOOL)startup:(MTRDeviceControllerStartupParamsInternal *)startupParams
return;
}

errorCode = _operationalCredentialsDelegate->GenerateNOC([startupParams.nodeId unsignedLongLongValue],
[startupParams.fabricID unsignedLongLongValue], chip::kUndefinedCATs, pubKey, noc);
errorCode = _operationalCredentialsDelegate->GenerateNOC(startupParams.nodeId.unsignedLongLongValue,
startupParams.fabricID.unsignedLongLongValue, chip::kUndefinedCATs, pubKey, noc);

if ([self checkForStartError:errorCode logMsg:kErrorGenerateNOC]) {
return;
Expand Down Expand Up @@ -624,7 +624,7 @@ - (void)removeDevice:(MTRDevice *)device
if (deviceToRemove == device) {
self.nodeIDToDeviceMap[device.nodeID] = nil;
} else {
MTR_LOG_ERROR("Error: Cannot remove device %p with nodeID %llu", device, [device.nodeID unsignedLongLongValue]);
MTR_LOG_ERROR("Error: Cannot remove device %p with nodeID %llu", device, device.nodeID.unsignedLongLongValue);
}
os_unfair_lock_unlock(&_deviceMapLock);
}
Expand Down
6 changes: 3 additions & 3 deletions src/darwin/Framework/CHIP/MTRDeviceControllerStartupParams.mm
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ - (instancetype)initWithSigningKeypair:(id<MTRKeypair>)nocSigner fabricID:(NSNum
return nil;
}

if (!IsValidFabricId([fabricID unsignedLongLongValue])) {
MTR_LOG_ERROR("%llu is not a valid fabric id to initialize a device controller with", [fabricID unsignedLongLongValue]);
if (!IsValidFabricId(fabricID.unsignedLongLongValue)) {
MTR_LOG_ERROR("%llu is not a valid fabric id to initialize a device controller with", fabricID.unsignedLongLongValue);
return nil;
}

Expand Down Expand Up @@ -127,7 +127,7 @@ @implementation MTRDeviceControllerStartupParams (Deprecated)

- (uint64_t)fabricId
{
return [self.fabricID unsignedLongLongValue];
return self.fabricID.unsignedLongLongValue;
}

- (instancetype)initWithSigningKeypair:(id<MTRKeypair>)nocSigner fabricId:(uint64_t)fabricId ipk:(NSData *)ipk
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ - (void)deregisterReportHandlersWithController:(id<NSCopying>)controller
if (handle) {
MTR_LOG_DEBUG("CHIP XPC connection requests to stop reports");
[handle.proxy stopReportsWithController:controller
nodeId:[nodeId unsignedLongLongValue]
nodeId:nodeId.unsignedLongLongValue
completion:^{
__auto_type handleRetainer = handle;
(void) handleRetainer;
Expand Down
10 changes: 5 additions & 5 deletions src/darwin/Framework/CHIP/MTRDeviceOverXPC.m
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ - (void)subscribeWithQueue:(dispatch_queue_t)queue
getProxyHandleWithCompletion:^(dispatch_queue_t _Nonnull proxyQueue, MTRDeviceControllerXPCProxyHandle * _Nullable handle) {
if (handle) {
[handle.proxy subscribeWithController:self.controller
nodeId:[self.nodeId unsignedLongLongValue]
nodeId:self.nodeId.unsignedLongLongValue
minInterval:minInterval
maxInterval:maxInterval
params:[MTRDeviceController encodeXPCSubscribeParams:params]
Expand Down Expand Up @@ -103,7 +103,7 @@ - (void)readAttributeWithEndpointId:(NSNumber * _Nullable)endpointId
getProxyHandleWithCompletion:^(dispatch_queue_t _Nonnull queue, MTRDeviceControllerXPCProxyHandle * _Nullable handle) {
if (handle) {
[handle.proxy readAttributeWithController:self.controller
nodeId:[self.nodeId unsignedLongLongValue]
nodeId:self.nodeId.unsignedLongLongValue
endpointId:endpointId
clusterId:clusterId
attributeId:attributeId
Expand Down Expand Up @@ -140,7 +140,7 @@ - (void)writeAttributeWithEndpointId:(NSNumber *)endpointId
getProxyHandleWithCompletion:^(dispatch_queue_t _Nonnull queue, MTRDeviceControllerXPCProxyHandle * _Nullable handle) {
if (handle) {
[handle.proxy writeAttributeWithController:self.controller
nodeId:[self.nodeId unsignedLongLongValue]
nodeId:self.nodeId.unsignedLongLongValue
endpointId:endpointId
clusterId:clusterId
attributeId:attributeId
Expand Down Expand Up @@ -178,7 +178,7 @@ - (void)invokeCommandWithEndpointId:(NSNumber *)endpointId
getProxyHandleWithCompletion:^(dispatch_queue_t _Nonnull queue, MTRDeviceControllerXPCProxyHandle * _Nullable handle) {
if (handle) {
[handle.proxy invokeCommandWithController:self.controller
nodeId:[self.nodeId unsignedLongLongValue]
nodeId:self.nodeId.unsignedLongLongValue
endpointId:endpointId
clusterId:clusterId
commandId:commandId
Expand Down Expand Up @@ -253,7 +253,7 @@ - (void)subscribeAttributeWithEndpointId:(NSNumber * _Nullable)endpointId
}
}];
[handle.proxy subscribeAttributeWithController:self.controller
nodeId:[self.nodeId unsignedLongLongValue]
nodeId:self.nodeId.unsignedLongLongValue
endpointId:endpointId
clusterId:clusterId
attributeId:attributeId
Expand Down
12 changes: 6 additions & 6 deletions src/darwin/Framework/CHIP/MTRThreadOperationalDataset.mm
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ - (nullable instancetype)initWithNetworkName:(NSString *)networkName
panID:(NSData *)panID
{
if (self = [super init]) {
_networkName = networkName;
_extendedPANID = extendedPANID;
_masterKey = masterKey;
_PSKc = PSKc;
_channelNumber = channelNumber;
_panID = panID;
_networkName = [networkName copy];
_extendedPANID = [extendedPANID copy];
_masterKey = [masterKey copy];
_PSKc = [PSKc copy];
_channelNumber = [channelNumber copy];
_panID = [panID copy];
_cppThreadOperationalDataset = chip::Thread::OperationalDataset();
if ([self _populateCppOperationalDataset]) {
return self;
Expand Down
6 changes: 3 additions & 3 deletions src/darwin/Framework/CHIPTests/MTRXPCProtocolTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,12 @@ - (void)subscribeWithDeviceController:(MTRDeviceController *)deviceController
completion(error);
});
};
[deviceController getBaseDevice:[deviceId unsignedLongLongValue]
[deviceController getBaseDevice:deviceId.unsignedLongLongValue
queue:workQueue
completionHandler:^(MTRBaseDevice * _Nullable device, NSError * _Nullable error) {
if (error) {
NSLog(@"Error: Failed to get connected device (%llu) for attribute cache: %@",
[deviceId unsignedLongLongValue], error);
deviceId.unsignedLongLongValue, error);
completionHandler(error);
return;
}
Expand All @@ -126,7 +126,7 @@ - (void)subscribeWithDeviceController:(MTRDeviceController *)deviceController
}
}
subscriptionEstablished:^() {
NSLog(@"Attribute cache subscription succeeded for device %llu", [deviceId unsignedLongLongValue]);
NSLog(@"Attribute cache subscription succeeded for device %llu", deviceId.unsignedLongLongValue);
if (![established[0] boolValue]) {
established[0] = @YES;
completionHandler(nil);
Expand Down

0 comments on commit cfa17ab

Please sign in to comment.