Skip to content

Commit 1edcafa

Browse files
authored
Merge pull request #43 from cslrfid/release-3.6
Added ASCII display to tag inventory page
2 parents 35f44aa + 94477cf commit 1edcafa

File tree

10 files changed

+205
-155
lines changed

10 files changed

+205
-155
lines changed

CS108iOSClient.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@
697697
"$(inherited)",
698698
"@executable_path/Frameworks",
699699
);
700-
MARKETING_VERSION = 3.5;
700+
MARKETING_VERSION = 3.6;
701701
PRODUCT_BUNDLE_IDENTIFIER = com.csl.CS108iOSClient;
702702
PRODUCT_NAME = "$(TARGET_NAME)";
703703
TARGETED_DEVICE_FAMILY = "1,2";
@@ -720,7 +720,7 @@
720720
"$(inherited)",
721721
"@executable_path/Frameworks",
722722
);
723-
MARKETING_VERSION = 3.5;
723+
MARKETING_VERSION = 3.6;
724724
PRODUCT_BUNDLE_IDENTIFIER = com.csl.CS108iOSClient;
725725
PRODUCT_NAME = "$(TARGET_NAME)";
726726
TARGETED_DEVICE_FAMILY = "1,2";

CS108iOSClient.xcodeproj/xcuserdata/TurtleMac01.xcuserdatad/xcschemes/CS108iOSClient.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1310"
3+
LastUpgradeVersion = "1400"
44
version = "1.7">
55
<BuildAction
66
parallelizeBuildables = "YES"

CS108iOSClient/CSLRfidDemoApp.storyboard

Lines changed: 158 additions & 136 deletions
Large diffs are not rendered by default.

CS108iOSClient/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<key>CFBundleShortVersionString</key>
2020
<string>$(MARKETING_VERSION)</string>
2121
<key>CFBundleVersion</key>
22-
<string>3060</string>
22+
<string>3076</string>
2323
<key>LSRequiresIPhoneOS</key>
2424
<true/>
2525
<key>NSBluetoothAlwaysUsageDescription</key>

CS108iOSClient/ViewControllers/CSLInventoryVC.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@
2626
@property (weak, nonatomic) IBOutlet UIView *uivSendTagData;
2727
@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *actInventorySpinner;
2828
@property (weak, nonatomic) IBOutlet UILabel *lbElapsedTime;
29+
@property (weak, nonatomic) IBOutlet UIButton *btnTagDisplay;
2930

3031
- (IBAction)btnInventoryPressed:(id)sender;
3132
- (IBAction)btnClearTable:(id)sender;
3233
- (IBAction)btnSendTagData:(id)sender;
3334
- (IBAction)btnSaveData:(id)sender;
35+
- (IBAction)btnTagDispalyPressed:(id)sender;
3436

3537

3638

CS108iOSClient/ViewControllers/CSLInventoryVC.m

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ @implementation CSLInventoryVC
3535
@synthesize lbMode;
3636
@synthesize uivSendTagData;
3737
@synthesize lbElapsedTime;
38+
@synthesize btnTagDisplay;
3839

3940
- (void)viewDidLoad {
4041
[super viewDidLoad];
@@ -326,7 +327,7 @@ - (IBAction)btnInventoryPressed:(id)sender {
326327

327328
}
328329

329-
- (IBAction)btnClearTable:(id)sender {
330+
- (void)ClearTable {
330331
//clear UI
331332
lbTagRate.text=@"0";
332333
lbTagCount.text=@"0";
@@ -336,8 +337,26 @@ - (IBAction)btnClearTable:(id)sender {
336337
[tblTagList reloadData];
337338
}
338339

340+
- (IBAction)btnClearTable:(id)sender {
341+
[self ClearTable];
342+
}
343+
344+
- (IBAction)btnTagDispalyPressed:(id)sender {
345+
if ([[self->btnTagDisplay currentTitle] containsString:@"HEX"]) {
346+
[self ClearTable];
347+
[btnTagDisplay setTitle:@"Display: ASCII" forState:UIControlStateNormal];
348+
}
349+
else {
350+
[self ClearTable];
351+
[btnTagDisplay setTitle:@"Display: HEX" forState:UIControlStateNormal];
352+
}
353+
354+
}
355+
339356
- (IBAction)btnSaveData:(id)sender {
340357

358+
bool IsAsciiDisplay = [[self->btnTagDisplay currentTitle] containsString:@"ASCII"];
359+
341360
NSString* fileContent = @"TIMESTAMP,EPC,DATA1,DATA2,RSSI\n";
342361

343362
for (CSLBleTag* tag in [CSLRfidAppEngine sharedAppEngine].reader.filteredBuffer) {
@@ -349,7 +368,7 @@ - (IBAction)btnSaveData:(id)sender {
349368
NSString *stringFromDate = [dateFormatter stringFromDate:date];
350369

351370

352-
fileContent=[fileContent stringByAppendingString:[NSString stringWithFormat:@"%@,%@,%@,%@,%@\n", stringFromDate, tag.EPC, tag.DATA1, tag.DATA2, [NSString stringWithFormat:@"%d",tag.rssi]]];
371+
fileContent=[fileContent stringByAppendingString:[NSString stringWithFormat:@"%@,%@,%@,%@,%@\n", stringFromDate, (IsAsciiDisplay ? [CSLReaderBarcode convertHexStringToAscii:tag.EPC] : tag.EPC), (IsAsciiDisplay ? [CSLReaderBarcode convertHexStringToAscii:tag.DATA1] : tag.DATA1), (IsAsciiDisplay ? [CSLReaderBarcode convertHexStringToAscii:tag.DATA2] : tag.DATA2), [NSString stringWithFormat:@"%d",tag.rssi]]];
353372
}
354373

355374
NSArray *objectsToShare = @[fileContent];
@@ -452,7 +471,7 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
452471

453472
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
454473
{
455-
474+
bool IsAsciiDisplay = [[self->btnTagDisplay currentTitle] containsString:@"ASCII"];
456475
CSLTagListCell * cell;
457476
//for rfid data
458477
if ([[[CSLRfidAppEngine sharedAppEngine].reader.filteredBuffer objectAtIndex:indexPath.row] isKindOfClass:[CSLBleTag class]]) {
@@ -472,22 +491,22 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
472491
}
473492

474493
if (data1 != NULL && data2 != NULL ) {
475-
cell.lbCellEPC.text = [NSString stringWithFormat:@"%d \u25CF %@", (int)(indexPath.row + 1), epc];
494+
cell.lbCellEPC.text = [NSString stringWithFormat:@"%d \u25CF %@", (int)(indexPath.row + 1), (IsAsciiDisplay ? [CSLReaderBarcode convertHexStringToAscii:epc] : epc)];
476495
if ([CSLRfidAppEngine sharedAppEngine].reader.readerModelNumber == CS463)
477-
cell.lbCellBank.text= [NSString stringWithFormat:@"%@=%@\n%@=%@\nRSSI: %d | Port: %d", data1bank, data1, data2bank, data2, rssi, portNumber+1];
496+
cell.lbCellBank.text= [NSString stringWithFormat:@"%@=%@\n%@=%@\nRSSI: %d | Port: %d", data1bank, (IsAsciiDisplay ? [CSLReaderBarcode convertHexStringToAscii:data1] : data1), data2bank, (IsAsciiDisplay ? [CSLReaderBarcode convertHexStringToAscii:data2] : data2), rssi, portNumber+1];
478497
else
479-
cell.lbCellBank.text= [NSString stringWithFormat:@"%@=%@\n%@=%@\nRSSI: %d", data1bank, data1, data2bank, data2, rssi];
498+
cell.lbCellBank.text= [NSString stringWithFormat:@"%@=%@\n%@=%@\nRSSI: %d", data1bank, (IsAsciiDisplay ? [CSLReaderBarcode convertHexStringToAscii:data1] : data1), data2bank, (IsAsciiDisplay ? [CSLReaderBarcode convertHexStringToAscii:data2] : data2), rssi];
480499
}
481500
else if (data1 != NULL) {
482-
cell.lbCellEPC.text = [NSString stringWithFormat:@"%d \u25CF %@", (int)(indexPath.row + 1), epc];
483-
cell.lbCellBank.text= [NSString stringWithFormat:@"%@=%@\nRSSI: %d", data1bank, data1, rssi];
501+
cell.lbCellEPC.text = [NSString stringWithFormat:@"%d \u25CF %@", (int)(indexPath.row + 1), (IsAsciiDisplay ? [CSLReaderBarcode convertHexStringToAscii:epc] : epc)];
502+
cell.lbCellBank.text= [NSString stringWithFormat:@"%@=%@\nRSSI: %d", data1bank, (IsAsciiDisplay ? [CSLReaderBarcode convertHexStringToAscii:data1] : data1), rssi];
484503
if ([CSLRfidAppEngine sharedAppEngine].reader.readerModelNumber == CS463)
485-
cell.lbCellBank.text= [NSString stringWithFormat:@"%@=%@\nRSSI: %d | Port: %d", data1bank, data1, rssi, portNumber+1];
504+
cell.lbCellBank.text= [NSString stringWithFormat:@"%@=%@\nRSSI: %d | Port: %d", data1bank, (IsAsciiDisplay ? [CSLReaderBarcode convertHexStringToAscii:data1] : data1), rssi, portNumber+1];
486505
else
487-
cell.lbCellBank.text= [NSString stringWithFormat:@"%@=%@\nRSSI: %d", data1bank, data1, rssi];
506+
cell.lbCellBank.text= [NSString stringWithFormat:@"%@=%@\nRSSI: %d", data1bank, (IsAsciiDisplay ? [CSLReaderBarcode convertHexStringToAscii:data1] : data1), rssi];
488507
}
489508
else {
490-
cell.lbCellEPC.text = [NSString stringWithFormat:@"%d \u25CF %@", (int)(indexPath.row + 1), epc];
509+
cell.lbCellEPC.text = [NSString stringWithFormat:@"%d \u25CF %@", (int)(indexPath.row + 1), (IsAsciiDisplay ? [CSLReaderBarcode convertHexStringToAscii:epc] : epc)];
491510
if ([CSLRfidAppEngine sharedAppEngine].reader.readerModelNumber == CS463)
492511
cell.lbCellBank.text= [NSString stringWithFormat:@"RSSI: %d | Port: %d", rssi, portNumber+1];
493512
else
@@ -505,7 +524,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
505524
cell = [tableView dequeueReusableCellWithIdentifier:@"TagCell"];
506525
}
507526

508-
cell.lbCellEPC.text = [NSString stringWithFormat:@"%d \u25CF %@", (int)(indexPath.row + 1), bc];
527+
cell.lbCellEPC.text = [NSString stringWithFormat:@"%d \u25CF %@", (int)(indexPath.row + 1), (IsAsciiDisplay ? [CSLReaderBarcode convertHexStringToAscii:bc] : bc)];
509528
cell.lbCellBank.text= [NSString stringWithFormat:@"[%@]", ((CSLReaderBarcode*)[[CSLRfidAppEngine sharedAppEngine].reader.filteredBuffer objectAtIndex:indexPath.row]).codeId];
510529

511530
}

CS108iOSClient/model/CSLReaderBarcode.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,11 @@ + (NSString*) convertDataToHexString:(NSData*) data {
131131
}
132132

133133
+ (NSString*) convertHexStringToAscii:(NSString*) hexString {
134+
//in the case where user provide hex string with odd length
135+
if ([hexString length] % 2 != 0) {
136+
return @"";
137+
}
138+
134139
NSMutableString * newString = [[NSMutableString alloc] init];
135140
int i = 0;
136141
while (i < [hexString length])

Pods/Pods.xcodeproj/project.pbxproj

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Pods.xcodeproj/xcuserdata/TurtleMac01.xcuserdatad/xcschemes/MQTTClient.xcscheme

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Pods/Pods.xcodeproj/xcuserdata/TurtleMac01.xcuserdatad/xcschemes/Pods-CS108iOSClient.xcscheme

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)