Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose some more information on MTRDevice/MTRCluster*. #29769

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/darwin/Framework/CHIP/MTRCluster.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ NS_ASSUME_NONNULL_BEGIN
@interface MTRCluster : NSObject
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;

/**
* The endpoint this cluster lives on.
*/
@property (nonatomic, readonly) NSNumber * endpointID NS_REFINED_FOR_SWIFT MTR_NEWLY_AVAILABLE;
@end

/**
Expand Down
11 changes: 11 additions & 0 deletions src/darwin/Framework/CHIP/MTRDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,17 @@ typedef NS_ENUM(NSUInteger, MTRDeviceState) {
@property (nonatomic, readonly, nullable)
NSDate * estimatedStartTime MTR_AVAILABLE(ios(16.5), macos(13.4), watchos(9.5), tvos(16.5));

/**
* The controller this device was created for. May return nil if that
* controller has been shut down.
*/
@property (nonatomic, readonly, nullable) MTRDeviceController * deviceController MTR_NEWLY_AVAILABLE;

/**
* The node ID of the node this device corresponds to.
*/
@property (nonatomic, readonly, copy) NSNumber * nodeID NS_REFINED_FOR_SWIFT MTR_NEWLY_AVAILABLE;

/**
* Set the delegate to receive asynchronous callbacks about the device.
*
Expand Down
2 changes: 0 additions & 2 deletions src/darwin/Framework/CHIP/MTRDevice_Internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ typedef void (^MTRDevicePerformAsyncBlock)(MTRBaseDevice * baseDevice);
queue:(dispatch_queue_t)queue
completion:(void (^)(id _Nullable response, NSError * _Nullable error))completion;

@property (nonatomic, readonly) MTRDeviceController * deviceController;
@property (nonatomic, readonly, copy) NSNumber * nodeID;
// Queue used for various internal bookkeeping work.
@property (nonatomic) dispatch_queue_t queue;
@property (nonatomic, readonly) MTRAsyncWorkQueue<MTRDevice *> * asyncWorkQueue;
Expand Down
5 changes: 5 additions & 0 deletions src/darwin/Framework/CHIP/templates/MTRClusters.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ NS_ASSUME_NONNULL_BEGIN
endpointID:(NSNumber *)endpointID
queue:(dispatch_queue_t)queue NS_DESIGNATED_INITIALIZER {{availability (asUpperCamelCase name preserveAcronyms=true) minimalRelease="First major API revamp"}};

/**
* The device this cluster object is associated with.
*/
@property (nonatomic, readonly) MTRDevice * device {{availability (asUpperCamelCase name preserveAcronyms=true) minimalRelease="Future"}};
woody-apple marked this conversation as resolved.
Show resolved Hide resolved

{{#zcl_commands}}
{{#if (is_str_equal source 'client')}}
{{! Takes two arguments: cluster name and command name, plus the ambient state where the command is "this" }}
Expand Down
11 changes: 2 additions & 9 deletions src/darwin/Framework/CHIP/templates/MTRClusters_Internal.zapt
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,5 @@
#import "MTRDevice.h"
#import "MTRDevice_Internal.h"

{{#zcl_clusters}}

{{#if (isSupported (asUpperCamelCase name preserveAcronyms=true))}}
@interface MTRCluster{{asUpperCamelCase name preserveAcronyms=true}} ()
@property (nonatomic, readonly) MTRDevice *device;
@end
{{/if}}

{{/zcl_clusters}}
// Nothing here for now, but leaving this file in place in case we need to add
// something.
470 changes: 470 additions & 0 deletions src/darwin/Framework/CHIP/zap-generated/MTRClusters.h

Large diffs are not rendered by default.

Loading
Loading