Skip to content

Commit

Permalink
[Darwin] MTRDevice should support multiple delegates
Browse files Browse the repository at this point in the history
  • Loading branch information
jtung-apple committed Jun 11, 2024
1 parent 47097e0 commit abe51d9
Show file tree
Hide file tree
Showing 5 changed files with 581 additions and 156 deletions.
23 changes: 21 additions & 2 deletions src/darwin/Framework/CHIP/MTRDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,26 @@ 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.
*/
- (void)setDelegate:(id<MTRDeviceDelegate>)delegate queue:(dispatch_queue_t)queue;
- (void)setDelegate:(id<MTRDeviceDelegate>)delegate queue:(dispatch_queue_t)queue MTR_NEWLY_DEPRECATED("Please use addDelegate:queue:interestedPaths:");

/**
* Adds a delegate to receive asynchronous callbacks about the device.
*
* The delegate will be called on the provided queue, for attribute reports, event reports, and device state changes.
*/
- (void)addDelegate:(id<MTRDeviceDelegate>)delegate queue:(dispatch_queue_t)queue MTR_NEWLY_AVAILABLE;

/**
* Adds a delegate to receive asynchronous callbacks about the device, and limit attribute reports to a specific set of paths.
*
* interestedAttributePaths may contain either MTRClusterPath or MTRAttributePath.
*/
- (void)addDelegate:(id<MTRDeviceDelegate>)delegate queue:(dispatch_queue_t)queue interestedAttributePaths:(NSArray *)interestedAttributePaths MTR_NEWLY_AVAILABLE;

/**
* Removes the delegate from
*/
- (void)removeDelegate:(id<MTRDeviceDelegate>)delegate MTR_NEWLY_AVAILABLE;

/**
* Read attribute in a designated attribute path. If there is no value available
Expand Down Expand Up @@ -389,7 +408,7 @@ MTR_EXTERN NSString * const MTRDataVersionKey MTR_AVAILABLE(ios(17.6), macos(14.
*
* The data-value dictionary also contains this key:
*
* MTRDataVersionKey : NSNumber-wrapped uin32_t. Monotonically increaseing data version for the cluster.
* MTRDataVersionKey : NSNumber-wrapped uin32_t.
*/
- (void)device:(MTRDevice *)device receivedAttributeReport:(NSArray<NSDictionary<NSString *, id> *> *)attributeReport;

Expand Down
Loading

0 comments on commit abe51d9

Please sign in to comment.