Skip to content

Commit

Permalink
renaming: MTRDevice -> MTRDeviceConcrete
Browse files Browse the repository at this point in the history
does not include insertion of new superclass or any minor tweaks outside the main code body to make the rename work, so might be broken to tests
  • Loading branch information
kiel-apple committed Aug 2, 2024
1 parent 2bd9d0b commit 0977039
Show file tree
Hide file tree
Showing 30 changed files with 209 additions and 209 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
ChipLogProgress(chipTool, "Downloading logs from node 0x" ChipLogFormatX64, ChipLogValueX64(mNodeId));

MTRDeviceController * commissioner = CurrentCommissioner();
auto * device = [MTRDevice deviceWithNodeID:@(mNodeId) controller:commissioner];
auto * device = [MTRDeviceConcrete deviceWithNodeID:@(mNodeId) controller:commissioner];

auto logType = static_cast<MTRDiagnosticLogType>(mLogType);
auto queue = dispatch_queue_create("com.chip.bdx.downloader", DISPATCH_QUEUE_SERIAL);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
{
mWorkQueue = dispatch_queue_create("com.chip.open_commissioning_window", DISPATCH_QUEUE_SERIAL);
auto * controller = CurrentCommissioner();
auto * device = [MTRDevice deviceWithNodeID:mNodeId deviceController:controller];
auto * device = [MTRDeviceConcrete deviceWithNodeID:mNodeId deviceController:controller];

auto * self = this;
if (mCommissioningWindowOption == 0) {
Expand Down
4 changes: 2 additions & 2 deletions src/darwin/Framework/CHIP/MTRBaseDevice_Internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ static inline MTRTransportType MTRMakeTransportType(chip::Transport::Type type)
@property (nonatomic, assign, readonly) BOOL isPASEDevice;

/**
* Controller that that this MTRDevice was gotten from.
* Controller that that this MTRDeviceConcrete was gotten from.
*/
@property (nonatomic, strong, readonly) MTRDeviceController * deviceController;

/**
* Node id for this MTRDevice. If this device represents a CASE session, this
* Node id for this MTRDeviceConcrete. If this device represents a CASE session, this
* is set to the node ID of the target node. If this device represents a PASE
* session, this is set to the device id of the PASE device.
*/
Expand Down
4 changes: 2 additions & 2 deletions src/darwin/Framework/CHIP/MTRBaseSubscriptionCallback.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@

/**
* This file defines a base class for subscription callbacks used by
* MTRBaseDevice and MTRDevice. This base class handles everything except the
* MTRBaseDevice and MTRDeviceConcrete. This base class handles everything except the
* actual conversion from the incoming data to the desired data and the dispatch
* of callbacks to the relevant client queues. Its callbacks are called on the
* Matter queue. This allows MTRDevice and MTRBaseDevice to do any necessary
* Matter queue. This allows MTRDeviceConcrete and MTRBaseDevice to do any necessary
* sync cleanup work before dispatching to the client callbacks on the client
* queue.
*
Expand Down
6 changes: 3 additions & 3 deletions src/darwin/Framework/CHIP/MTRCluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ typedef void (^MTRStatusCompletion)(NSError * _Nullable error);
typedef void (^MTRSubscriptionEstablishedHandler)(void);

@class MTRBaseDevice;
@class MTRDevice;
@class MTRDeviceConcrete;

NS_ASSUME_NONNULL_BEGIN

Expand Down Expand Up @@ -63,7 +63,7 @@ MTR_AVAILABLE(ios(17.4), macos(14.4), watchos(10.4), tvos(17.4))
/**
* The device this cluster object is associated with.
*/
@property (nonatomic, strong, readonly) MTRDevice * device;
@property (nonatomic, strong, readonly) MTRDeviceConcrete * device;
@end

/**
Expand Down Expand Up @@ -139,7 +139,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1))
*
* This setting is only relevant to some consumers of MTRReadParams. One of
* those consumers is readAttributeWithEndpointID:clusterID:attributeID:params:
* on MTRDevice.
* on MTRDeviceConcrete.
*/
@property (nonatomic, assign, getter=shouldAssumeUnknownAttributesReportable) BOOL assumeUnknownAttributesReportable MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6));

Expand Down
2 changes: 1 addition & 1 deletion src/darwin/Framework/CHIP/MTRCluster.mm
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ - (instancetype)initWithDevice:(MTRBaseDevice *)device endpointID:(NSNumber *)en

@implementation MTRGenericCluster

- (instancetype)initWithDevice:(MTRDevice *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue
- (instancetype)initWithDevice:(MTRDeviceConcrete *)device endpointID:(NSNumber *)endpointID queue:(dispatch_queue_t)queue
{
if (self = [super initWithEndpointID:endpointID queue:queue]) {
_device = device;
Expand Down
4 changes: 2 additions & 2 deletions src/darwin/Framework/CHIP/MTRCluster_Internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#import <Matter/MTRBaseDevice.h>
#import <Matter/MTRCluster.h>
#import <Matter/MTRDevice.h>
#import <Matter/MTRDeviceConcrete.h>

#import "MTRBaseDevice_Internal.h"

Expand All @@ -43,7 +43,7 @@ NS_ASSUME_NONNULL_BEGIN
@end

@interface MTRGenericCluster ()
- (instancetype)initWithDevice:(MTRDevice *)device
- (instancetype)initWithDevice:(MTRDeviceConcrete *)device
endpointID:(NSNumber *)endpointID
queue:(dispatch_queue_t)queue;
@end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,20 @@ typedef NS_ENUM(NSUInteger, MTRDeviceState) {
@protocol MTRDeviceDelegate;

MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1))
@interface MTRDevice : NSObject
@interface MTRDeviceConcrete : NSObject
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;

/**
* TODO: Document usage better
*
* Directly instantiate a MTRDevice with a MTRDeviceController as a shim.
* Directly instantiate a MTRDeviceConcrete with a MTRDeviceController as a shim.
*
* All device-specific information would be stored on the device controller, and
* retrieved when performing actions using a combination of MTRBaseDevice
* and MTRAsyncCallbackQueue.
*/
+ (MTRDevice *)deviceWithNodeID:(NSNumber *)nodeID
+ (MTRDeviceConcrete *)deviceWithNodeID:(NSNumber *)nodeID
controller:(MTRDeviceController *)controller MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4));

/**
Expand Down Expand Up @@ -121,7 +121,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1))
*
* The delegate will be called on the provided queue, for attribute reports, event reports, and device state changes.
*
* MTRDevice holds a weak reference to the delegate object.
* MTRDeviceConcrete holds a weak reference to the delegate object.
*/
- (void)addDelegate:(id<MTRDeviceDelegate>)delegate queue:(dispatch_queue_t)queue MTR_AVAILABLE(ios(18.0), macos(15.0), watchos(11.0), tvos(18.0));

Expand All @@ -136,7 +136,7 @@ MTR_AVAILABLE(ios(16.1), macos(13.0), watchos(9.1), tvos(16.1))
*
* Calling addDelegate: again with the same delegate object will update the interested paths for attributes and events for this delegate.
*
* MTRDevice holds a weak reference to the delegate object.
* MTRDeviceConcrete holds a weak reference to the delegate object.
*/
- (void)addDelegate:(id<MTRDeviceDelegate>)delegate queue:(dispatch_queue_t)queue interestedPathsForAttributes:(NSArray * _Nullable)interestedPathsForAttributes interestedPathsForEvents:(NSArray * _Nullable)interestedPathsForEvents MTR_AVAILABLE(ios(18.0), macos(15.0), watchos(11.0), tvos(18.0));

Expand Down Expand Up @@ -405,10 +405,10 @@ MTR_EXTERN NSString * const MTRDataVersionKey MTR_AVAILABLE(ios(17.6), macos(14.
/**
* @param state The current state of the device
*/
- (void)device:(MTRDevice *)device stateChanged:(MTRDeviceState)state;
- (void)device:(MTRDeviceConcrete *)device stateChanged:(MTRDeviceState)state;

/**
* Notifies delegate of attribute reports from the MTRDevice
* Notifies delegate of attribute reports from the MTRDeviceConcrete
*
* @param attributeReport An array of response-value objects as described in MTRDeviceResponseHandler
*
Expand All @@ -420,10 +420,10 @@ MTR_EXTERN NSString * const MTRDataVersionKey MTR_AVAILABLE(ios(17.6), macos(14.
*
* MTRDataVersionKey : NSNumber-wrapped uin32_t.
*/
- (void)device:(MTRDevice *)device receivedAttributeReport:(NSArray<NSDictionary<NSString *, id> *> *)attributeReport;
- (void)device:(MTRDeviceConcrete *)device receivedAttributeReport:(NSArray<NSDictionary<NSString *, id> *> *)attributeReport;

/**
* Notifies delegate of event reports from the MTRDevice
* Notifies delegate of event reports from the MTRDeviceConcrete
*
* @param eventReport An array of response-value objects as described in MTRDeviceResponseHandler
*
Expand All @@ -440,7 +440,7 @@ MTR_EXTERN NSString * const MTRDataVersionKey MTR_AVAILABLE(ios(17.6), macos(14.
* Only one of MTREventTimestampDateKey and MTREventSystemUpTimeKey will be present, depending on the value for
* MTREventTimeTypeKey.
*/
- (void)device:(MTRDevice *)device receivedEventReport:(NSArray<NSDictionary<NSString *, id> *> *)eventReport;
- (void)device:(MTRDeviceConcrete *)device receivedEventReport:(NSArray<NSDictionary<NSString *, id> *> *)eventReport;

@optional
/**
Expand All @@ -449,33 +449,33 @@ MTR_EXTERN NSString * const MTRDataVersionKey MTR_AVAILABLE(ios(17.6), macos(14.
* This can be used as a hint that now is a good time to send commands to the
* device, especially if the device is sleepy and might not be active very often.
*/
- (void)deviceBecameActive:(MTRDevice *)device MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4));
- (void)deviceBecameActive:(MTRDeviceConcrete *)device MTR_AVAILABLE(ios(16.4), macos(13.3), watchos(9.4), tvos(16.4));

/**
* Notifies delegate when the device attribute cache has been primed with initial configuration data of the device
*
* This is called when the MTRDevice object goes from not knowing the device to having cached the first attribute reports that include basic mandatory information, e.g. Descriptor clusters.
* This is called when the MTRDeviceConcrete object goes from not knowing the device to having cached the first attribute reports that include basic mandatory information, e.g. Descriptor clusters.
*
* The intention is that after this is called, the client should be able to call read for mandatory attributes and likely expect non-nil values.
*/
- (void)deviceCachePrimed:(MTRDevice *)device MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6));
- (void)deviceCachePrimed:(MTRDeviceConcrete *)device MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6));

/**
* This is called when the MTRDevice object detects a change in the device configuration.
* This is called when the MTRDeviceConcrete object detects a change in the device configuration.
*
* Device configuration is the set of functionality implemented by the device.
*
*/
- (void)deviceConfigurationChanged:(MTRDevice *)device MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6));
- (void)deviceConfigurationChanged:(MTRDeviceConcrete *)device MTR_AVAILABLE(ios(17.6), macos(14.6), watchos(10.6), tvos(17.6));

@end

@interface MTRDevice (Deprecated)
@interface MTRDeviceConcrete (Deprecated)

/**
* Deprecated MTRDevice APIs.
* Deprecated MTRDeviceConcrete APIs.
*/
+ (MTRDevice *)deviceWithNodeID:(uint64_t)nodeID
+ (MTRDeviceConcrete *)deviceWithNodeID:(uint64_t)nodeID
deviceController:(MTRDeviceController *)deviceController
MTR_DEPRECATED(
"Please use deviceWithNodeID:controller:", ios(16.1, 16.4), macos(13.0, 13.3), watchos(9.1, 9.4), tvos(16.1, 16.4));
Expand Down
Loading

0 comments on commit 0977039

Please sign in to comment.