Skip to content

Commit

Permalink
Modify the log type bit mask to an enum and return the file paths as …
Browse files Browse the repository at this point in the history
…a dictionary mapped to the enum values
  • Loading branch information
nivi-apple committed Oct 10, 2023
1 parent 9d4fc68 commit 8108fa1
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/darwin/Framework/CHIP/MTRDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,15 @@ typedef NS_ENUM(NSUInteger, MTRDeviceState) {
};

/**
* This bitmask is used to specify the type of logs requested from this device.
* This enum is used to specify the type of logs requested from this device.
*
* The logs types are : End User Support, Network Diagnostics and Crash logs.
*/
typedef NS_OPTIONS(NSUInteger, MTRDiagnosticLogType) {
MTRDiagnosticLogTypeEndUserSupport = 1 << 0, // End user support logs are requested
MTRDiagnosticLogTypeNetworkDiagnostics = 1 << 1, // Network Diagnostics logs are requested
MTRDiagnosticLogTypeCrash = 1 << 2, // Crash logs are requested
MTRDiagnosticLogTypesAll = // All the above log types are requested
MTRDiagnosticLogTypeEndUserSupport | MTRDiagnosticLogTypeNetworkDiagnostics | MTRDiagnosticLogTypeCrash,
MTRDiagnosticLogTypeUnknown = 1 << 3,
typedef NS_ENUM(NSUInteger, MTRDiagnosticLogType) {
MTRDiagnosticLogTypeEndUserSupport = 1, // End user support logs are requested
MTRDiagnosticLogTypeNetworkDiagnostics = 2, // Network Diagnostics logs are requested
MTRDiagnosticLogTypeCrash = 3, // Crash logs are requested
MTRDiagnosticLogTypeUnknown = 4
} MTR_PROVISIONALLY_AVAILABLE;

@protocol MTRDeviceDelegate;
Expand All @@ -54,10 +52,11 @@ MTR_PROVISIONALLY_AVAILABLE
@property (readonly, nonatomic) BOOL requestTimedOut;

/**
* Array containing the file path(s) for the desired log type(s)
* Array containing the file path(s) for the desired log type(s).
* The log type values should correspond to the enum MTRDiagnosticLogType values.
* If there are no logs an empty array will be returned.
*/
@property (readonly, nonatomic) NSArray<NSString *> * filePathArray;
@property (readonly, nonatomic) NSDictionary<NSNumber *, NSString *> * filePathDictionary;

@end

Expand Down Expand Up @@ -234,16 +233,16 @@ MTR_PROVISIONALLY_AVAILABLE
/**
* Requests diagnostic logs of the desired types from the device.
*
* @param type The type of logs being requested.
* @param timeout The timeout for getting the logs. If the timeout expires, completion
* @param types The types of logs being requested. This should correspond to values in the enum MTRDiagnosticLogType.
* @param timeout The timeout in minutes for getting the logs. If the timeout expires, completion
* will be called with whatever logs have been retrieved by that point
* (which might be none, and might include partial logs).
* If the timeout is nil, it will never expire and completion will not be called until
* the logs are fully retrieved.
* @param queue The queue on which completion will be called.
* @param completion The completion that will be called to pass in the file paths for the requested logs.
*/
- (void)getDiagnosticLogsOfTypes:(MTRDiagnosticLogType)type
- (void)getDiagnosticLogsOfTypes:(NSArray<NSNumber *> *)types
timeout:(NSInteger * _Nullable)timeout
queue:(dispatch_queue_t)queue
completion:(void (^)(NSError * _Nullable error, MTRDiagnosticLogResult * _Nullable logResult))completion MTR_PROVISIONALLY_AVAILABLE;
Expand Down

0 comments on commit 8108fa1

Please sign in to comment.