Skip to content

Commit

Permalink
Restyled by clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
restyled-commits authored and sagar-apple committed May 29, 2020
1 parent 3132786 commit d8c10e4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 23 deletions.
7 changes: 2 additions & 5 deletions src/darwin/Framework/CHIP/CHIPSetupPayload.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,16 @@
* limitations under the License.
*/

#import <Foundation/Foundation.h>
#import "CHIPError.h"
#import <Foundation/Foundation.h>

#ifdef __cplusplus
#import <setup_payload/SetupPayload.h>
#endif

NS_ASSUME_NONNULL_BEGIN

typedef NS_ENUM(NSUInteger, OptionalQRCodeInfoType) {
kOptionalQRCodeInfoTypeString,
kOptionalQRCodeInfoTypeInt
};
typedef NS_ENUM(NSUInteger, OptionalQRCodeInfoType) { kOptionalQRCodeInfoTypeString, kOptionalQRCodeInfoTypeInt };

@interface CHIPOptionalQRCodeInfo : NSObject
@property (nonatomic, strong) NSNumber * infoType;
Expand Down
36 changes: 18 additions & 18 deletions src/darwin/Framework/CHIP/CHIPSetupPayload.mm
Original file line number Diff line number Diff line change
Expand Up @@ -43,35 +43,35 @@ - (id)initWithSetupPayload:(chip::SetupPayload)setupPayload

- (NSArray<CHIPOptionalQRCodeInfo *> *)getAllOptionalData:(NSError * __autoreleasing *)error
{
NSMutableArray<CHIPOptionalQRCodeInfo *> *allOptionalData = [NSMutableArray new];
NSMutableArray<CHIPOptionalQRCodeInfo *> * allOptionalData = [NSMutableArray new];
vector<chip::OptionalQRCodeInfo> chipOptionalData = _chipSetupPayload.getAllOptionalData();
for (chip::OptionalQRCodeInfo chipInfo : chipOptionalData) {
CHIPOptionalQRCodeInfo *info = [CHIPOptionalQRCodeInfo new];
for (chip::OptionalQRCodeInfo chipInfo : chipOptionalData) {
CHIPOptionalQRCodeInfo * info = [CHIPOptionalQRCodeInfo new];
info.tag = [NSNumber numberWithUnsignedLongLong:chipInfo.tag];
switch (chipInfo.type) {
case chip::optionalQRCodeInfoTypeString:
info.infoType = [NSNumber numberWithInt:kOptionalQRCodeInfoTypeString];
info.stringValue = [NSString stringWithUTF8String:chipInfo.data.c_str()];
break;
case chip::optionalQRCodeInfoTypeInt:
info.infoType = [NSNumber numberWithInt:kOptionalQRCodeInfoTypeInt];
info.integerValue = [NSNumber numberWithInt:chipInfo.integer];
break;
default:
if (error) {
*error = [NSError errorWithDomain:CHIPErrorDomain code:CHIPErrorCodeInvalidArgument userInfo:nil];
}
return @[];
case chip::optionalQRCodeInfoTypeString:
info.infoType = [NSNumber numberWithInt:kOptionalQRCodeInfoTypeString];
info.stringValue = [NSString stringWithUTF8String:chipInfo.data.c_str()];
break;
case chip::optionalQRCodeInfoTypeInt:
info.infoType = [NSNumber numberWithInt:kOptionalQRCodeInfoTypeInt];
info.integerValue = [NSNumber numberWithInt:chipInfo.integer];
break;
default:
if (error) {
*error = [NSError errorWithDomain:CHIPErrorDomain code:CHIPErrorCodeInvalidArgument userInfo:nil];
}
return @[];
}
[allOptionalData addObject:info];
[allOptionalData addObject:info];
}
return allOptionalData;
}

+ (NSNumber *)vendorTag:(NSNumber *)tagNumber error:(NSError * __autoreleasing *)error
{
uint64_t outTag;
NSNumber *vendorTag;
NSNumber * vendorTag;
CHIP_ERROR chipError = chip::VendorTag(tagNumber.unsignedShortValue, outTag);
if (chipError == CHIP_NO_ERROR) {
vendorTag = [NSNumber numberWithUnsignedLongLong:outTag];
Expand Down

0 comments on commit d8c10e4

Please sign in to comment.