Skip to content

Commit

Permalink
Merged in osx-migrate-to-develop-sdk (pull request PunchThrough#29)
Browse files Browse the repository at this point in the history
Osx migrate to develop sdk
  • Loading branch information
mplewis committed Mar 4, 2016
2 parents f649c82 + 481136b commit dd62357
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,13 @@ - (void)testFileToBytes
XCTAssertTrue([hexBytes isEqualToData:self.expectedBytes]);
}

/**
* Ensure PTDIntelHex sets the sketch name when it parses a sketch from an NSURL file object.
*/
- (void)testFileSetsName
{
PTDIntelHex *hexObject = [PTDIntelHex intelHexFromFileURL:[NSURL fileURLWithPath:self.intelHexPath]];
XCTAssertTrue([hexObject.name isEqualToString:@"IntelHexSource"]);
}

@end
11 changes: 10 additions & 1 deletion source/Helper/PTDIntelHex.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@

@interface PTDIntelHex : NSObject

@property(nonatomic, strong) NSString *name;
/**
* The name of the sketch this hex was compiled from. Used by Bean Loaders to set the name of Bean's sketch.
*/
@property (nonatomic, strong) NSString *name;
/**
* The version prefix of the hardware this sketch is intended for.
* For example, "1" = Bean, "2" = Bean+.
*/
@property (nonatomic, strong) NSString *beanHardwareVersion;

/**
* Create a PTDIntelHex object from a string of Intel HEX data.
Expand Down Expand Up @@ -30,3 +38,4 @@
- (NSData *)bytes;

@end

3 changes: 3 additions & 0 deletions source/Helper/PTDIntelHex.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ - (id)initWithFileURL:(NSURL *)file
if (![self parseHexString:fileContents]) {
return nil;
}

// Set this object's name property to the filename (without .hex extension) of the NSURL file
_name = [[[file absoluteString] lastPathComponent] componentsSeparatedByString:@"."][0];
}
return self;
}
Expand Down

0 comments on commit dd62357

Please sign in to comment.