Skip to content

Commit

Permalink
Address review comments:
Browse files Browse the repository at this point in the history
* Move Deprecated categories to the bottoms of headers.
* Fix unsignedIntegerValue use.
* Make sure we consistently treat a boxed 0 as "on-network" for rendezvousInformation.
* Make the NSSecureCoding serialization of MTRSetupPayload backwards-compatible.
  • Loading branch information
bzbarsky-apple committed Nov 1, 2022
1 parent 3acaa33 commit 8a60d41
Show file tree
Hide file tree
Showing 9 changed files with 1,187 additions and 1,161 deletions.
122 changes: 61 additions & 61 deletions src/darwin/Framework/CHIP/MTRBaseDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,67 @@ extern NSString * const MTRArrayValueType;

@end

@interface MTRAttributePath : NSObject <NSCopying>
@property (nonatomic, readonly, strong, nonnull) NSNumber * endpoint;
@property (nonatomic, readonly, strong, nonnull) NSNumber * cluster;
@property (nonatomic, readonly, strong, nonnull) NSNumber * attribute;

+ (instancetype)attributePathWithEndpointID:(NSNumber *)endpointID
clusterID:(NSNumber *)clusterID
attributeID:(NSNumber *)attributeID MTR_NEWLY_AVAILABLE;

- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
@end

@interface MTREventPath : NSObject
@property (nonatomic, readonly, strong, nonnull) NSNumber * endpoint;
@property (nonatomic, readonly, strong, nonnull) NSNumber * cluster;
@property (nonatomic, readonly, strong, nonnull) NSNumber * event;

+ (instancetype)eventPathWithEndpointID:(NSNumber *)endpointID
clusterID:(NSNumber *)clusterID
eventID:(NSNumber *)eventID MTR_NEWLY_AVAILABLE;

- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
@end

@interface MTRCommandPath : NSObject
@property (nonatomic, readonly, strong, nonnull) NSNumber * endpoint;
@property (nonatomic, readonly, strong, nonnull) NSNumber * cluster;
@property (nonatomic, readonly, strong, nonnull) NSNumber * command;

+ (instancetype)commandPathWithEndpointID:(NSNumber *)endpointID
clusterID:(NSNumber *)clusterID
commandID:(NSNumber *)commandID MTR_NEWLY_AVAILABLE;

- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
@end

@interface MTRAttributeReport : NSObject
@property (nonatomic, readonly, strong, nonnull) MTRAttributePath * path;
// value is nullable because nullable attributes can have nil as value.
@property (nonatomic, readonly, strong, nullable) id value;
// If this specific path resulted in an error, the error (in the
// MTRInteractionErrorDomain or MTRErrorDomain) that corresponds to this
// path.
@property (nonatomic, readonly, strong, nullable) NSError * error;
@end

@interface MTREventReport : NSObject
@property (nonatomic, readonly, strong, nonnull) MTREventPath * path;
@property (nonatomic, readonly, strong, nonnull) NSNumber * eventNumber; // chip::EventNumber type (uint64_t)
@property (nonatomic, readonly, strong, nonnull) NSNumber * priority; // chip::app::PriorityLevel type (uint8_t)
@property (nonatomic, readonly, strong, nonnull) NSNumber * timestamp; // chip::app::Timestamp.mValue type (uint64_t)
@property (nonatomic, readonly, strong, nullable) id value;
// If this specific path resulted in an error, the error (in the
// MTRInteractionErrorDomain or MTRErrorDomain) that corresponds to this
// path.
@property (nonatomic, readonly, strong, nullable) NSError * error;
@end

@interface MTRBaseDevice (Deprecated)

/**
Expand Down Expand Up @@ -331,19 +392,6 @@ extern NSString * const MTRArrayValueType;

@end

@interface MTRAttributePath : NSObject <NSCopying>
@property (nonatomic, readonly, strong, nonnull) NSNumber * endpoint;
@property (nonatomic, readonly, strong, nonnull) NSNumber * cluster;
@property (nonatomic, readonly, strong, nonnull) NSNumber * attribute;

+ (instancetype)attributePathWithEndpointID:(NSNumber *)endpointID
clusterID:(NSNumber *)clusterID
attributeID:(NSNumber *)attributeID MTR_NEWLY_AVAILABLE;

- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
@end

@interface MTRAttributePath (Deprecated)

+ (instancetype)attributePathWithEndpointId:(NSNumber *)endpointId
Expand All @@ -353,19 +401,6 @@ extern NSString * const MTRArrayValueType;

@end

@interface MTREventPath : NSObject
@property (nonatomic, readonly, strong, nonnull) NSNumber * endpoint;
@property (nonatomic, readonly, strong, nonnull) NSNumber * cluster;
@property (nonatomic, readonly, strong, nonnull) NSNumber * event;

+ (instancetype)eventPathWithEndpointID:(NSNumber *)endpointID
clusterID:(NSNumber *)clusterID
eventID:(NSNumber *)eventID MTR_NEWLY_AVAILABLE;

- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
@end

@interface MTREventPath (Deprecated)

+ (instancetype)eventPathWithEndpointId:(NSNumber *)endpointId
Expand All @@ -375,19 +410,6 @@ extern NSString * const MTRArrayValueType;

@end

@interface MTRCommandPath : NSObject
@property (nonatomic, readonly, strong, nonnull) NSNumber * endpoint;
@property (nonatomic, readonly, strong, nonnull) NSNumber * cluster;
@property (nonatomic, readonly, strong, nonnull) NSNumber * command;

+ (instancetype)commandPathWithEndpointID:(NSNumber *)endpointID
clusterID:(NSNumber *)clusterID
commandID:(NSNumber *)commandID MTR_NEWLY_AVAILABLE;

- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
@end

@interface MTRCommandPath (Deprecated)

+ (instancetype)commandPathWithEndpointId:(NSNumber *)endpointId
Expand All @@ -397,26 +419,4 @@ extern NSString * const MTRArrayValueType;

@end

@interface MTRAttributeReport : NSObject
@property (nonatomic, readonly, strong, nonnull) MTRAttributePath * path;
// value is nullable because nullable attributes can have nil as value.
@property (nonatomic, readonly, strong, nullable) id value;
// If this specific path resulted in an error, the error (in the
// MTRInteractionErrorDomain or MTRErrorDomain) that corresponds to this
// path.
@property (nonatomic, readonly, strong, nullable) NSError * error;
@end

@interface MTREventReport : NSObject
@property (nonatomic, readonly, strong, nonnull) MTREventPath * path;
@property (nonatomic, readonly, strong, nonnull) NSNumber * eventNumber; // chip::EventNumber type (uint64_t)
@property (nonatomic, readonly, strong, nonnull) NSNumber * priority; // chip::app::PriorityLevel type (uint8_t)
@property (nonatomic, readonly, strong, nonnull) NSNumber * timestamp; // chip::app::Timestamp.mValue type (uint64_t)
@property (nonatomic, readonly, strong, nullable) id value;
// If this specific path resulted in an error, the error (in the
// MTRInteractionErrorDomain or MTRErrorDomain) that corresponds to this
// path.
@property (nonatomic, readonly, strong, nullable) NSError * error;
@end

NS_ASSUME_NONNULL_END
22 changes: 11 additions & 11 deletions src/darwin/Framework/CHIP/MTRDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,17 +166,6 @@ typedef NS_ENUM(NSUInteger, MTRDeviceState) {

@end

@interface MTRDevice (Deprecated)

/**
* Deprecated MTRDevice APIs.
*/
+ (instancetype)deviceWithNodeID:(uint64_t)nodeID
deviceController:(MTRDeviceController *)deviceController
MTR_NEWLY_DEPRECATED("Please use deviceWithNodeID:controller:");

@end

@protocol MTRDeviceDelegate <NSObject>
@required
/**
Expand Down Expand Up @@ -206,4 +195,15 @@ typedef NS_ENUM(NSUInteger, MTRDeviceState) {

@end

@interface MTRDevice (Deprecated)

/**
* Deprecated MTRDevice APIs.
*/
+ (instancetype)deviceWithNodeID:(uint64_t)nodeID
deviceController:(MTRDeviceController *)deviceController
MTR_NEWLY_DEPRECATED("Please use deviceWithNodeID:controller:");

@end

NS_ASSUME_NONNULL_END
16 changes: 8 additions & 8 deletions src/darwin/Framework/CHIP/MTRDeviceController+XPC.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,6 @@ typedef void (^MTRValuesHandler)(id _Nullable values, NSError * _Nullable error)

@end

@interface MTRDeviceController (Deprecated_XPC)

+ (MTRDeviceController *)sharedControllerWithId:(id<NSCopying> _Nullable)controllerID
xpcConnectBlock:(MTRXPCConnectBlock)xpcConnectBlock
MTR_NEWLY_DEPRECATED("Please use sharedControllerWithID:xpcConnectBlock:");

@end

/**
* Protocol that remote object must support over XPC
*/
Expand Down Expand Up @@ -194,4 +186,12 @@ typedef void (^MTRValuesHandler)(id _Nullable values, NSError * _Nullable error)

@end

@interface MTRDeviceController (Deprecated_XPC)

+ (MTRDeviceController *)sharedControllerWithId:(id<NSCopying> _Nullable)controllerID
xpcConnectBlock:(MTRXPCConnectBlock)xpcConnectBlock
MTR_NEWLY_DEPRECATED("Please use sharedControllerWithID:xpcConnectBlock:");

@end

NS_ASSUME_NONNULL_END
12 changes: 6 additions & 6 deletions src/darwin/Framework/CHIP/MTRSetupPayload.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,6 @@ typedef NS_ENUM(NSUInteger, MTROptionalQRCodeInfoType) {
@property (nonatomic, copy, nullable) NSString * stringValue;
@end

@interface MTROptionalQRCodeInfo (Deprecated)

@property (nonatomic, copy) NSNumber * infoType MTR_NEWLY_DEPRECATED("Please use type");

@end

/**
* A setup payload that can be created from a pairing code and serialized to a
* pairing code.
Expand Down Expand Up @@ -132,6 +126,12 @@ typedef NS_ENUM(NSUInteger, MTROptionalQRCodeInfoType) {

@end

@interface MTROptionalQRCodeInfo (Deprecated)

@property (nonatomic, copy) NSNumber * infoType MTR_NEWLY_DEPRECATED("Please use type");

@end

@interface MTRSetupPayload (Deprecated)

@property (nonatomic, copy, nullable) NSNumber * rendezvousInformation MTR_NEWLY_DEPRECATED("Please use discoveryCapabilities");
Expand Down
Loading

0 comments on commit 8a60d41

Please sign in to comment.