-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7bb1fa0
commit 23a8af3
Showing
495 changed files
with
772 additions
and
516 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
AnylineExamples/Anyline Examples Source/Processes/Custom CMD/ALCustomOCRViewController.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#import <UIKit/UIKit.h> | ||
#import "ALBaseScanViewController.h" | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface ALCustomOCRViewController : ALBaseScanViewController | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
80 changes: 80 additions & 0 deletions
80
AnylineExamples/Anyline Examples Source/Processes/Custom CMD/ALCustomOCRViewController.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#import "ALCustomOCRViewController.h" | ||
#import <Anyline/Anyline.h> | ||
#import "AnylineExamples-Swift.h" | ||
|
||
static NSString * const kConfigFileName = @"cow_tag_config"; | ||
|
||
@interface ALCustomOCRViewController () <ALScanPluginDelegate> | ||
|
||
@end | ||
|
||
|
||
@implementation ALCustomOCRViewController | ||
|
||
- (void)viewDidLoad { | ||
[super viewDidLoad]; | ||
|
||
self.title = @"Custom CMD File (Cattle Tag)"; | ||
self.controllerType = ALScanHistoryCattleTag; | ||
|
||
NSDictionary *configDict = [[self configJSONStrWithFilename:kConfigFileName] asJSONObject]; | ||
|
||
NSError *error; | ||
ALScanViewPlugin *scanViewPlugin = [[ALScanViewPlugin alloc] initWithJSONDictionary:configDict | ||
error:&error]; | ||
scanViewPlugin.scanPlugin.delegate = self; | ||
if ([self popWithAlertOnError:error]) { | ||
return; | ||
} | ||
|
||
if (!self.scanView) { | ||
self.scanView = [[ALScanView alloc] initWithFrame:CGRectZero | ||
scanViewPlugin:scanViewPlugin | ||
error:&error]; | ||
if ([self popWithAlertOnError:error]) { | ||
return; | ||
} | ||
[self installScanView:self.scanView]; | ||
} else { | ||
[self.scanView setScanViewPlugin:scanViewPlugin error:&error]; | ||
if ([self popWithAlertOnError:error]) { | ||
return; | ||
} | ||
} | ||
|
||
[self.scanView startCamera]; | ||
[self startScanning:nil]; | ||
} | ||
|
||
- (void)viewWillAppear:(BOOL)animated { | ||
[super viewWillAppear:animated]; | ||
[self startScanning:nil]; | ||
} | ||
|
||
- (void)viewWillDisappear:(BOOL)animated { | ||
[super viewWillDisappear:animated]; | ||
[self stopScanning]; | ||
} | ||
|
||
|
||
// MARK: - ALScanPluginDelegate | ||
|
||
- (void)scanPlugin:(ALScanPlugin *)scanPlugin resultReceived:(ALScanResult *)scanResult { | ||
NSArray<ALResultEntry*> *resultData = scanResult.pluginResult.fieldList.resultEntries; | ||
NSString *resultDataJSONStr = [ALResultEntry JSONStringFromList:resultData]; | ||
__weak UIViewController *weakSelf = self; | ||
[self anylineDidFindResult:resultDataJSONStr | ||
barcodeResult:@"" | ||
image:scanResult.croppedImage | ||
scanPlugin:scanPlugin | ||
viewPlugin:self.scanViewPlugin | ||
completion:^{ | ||
ALResultViewController *vc = [[ALResultViewController alloc] | ||
initWithResults:resultData]; | ||
vc.imagePrimary = scanResult.croppedImage; | ||
|
||
[weakSelf.navigationController pushViewController:vc animated:YES]; | ||
}]; | ||
} | ||
|
||
@end |
1 change: 1 addition & 0 deletions
1
AnylineExamples/Anyline Examples Source/Processes/Custom CMD/Resources/cow_tag_scanner.ale
Large diffs are not rendered by default.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
AnylineExamples/Anyline Examples Source/Processes/Custom CMD/cow_tag_config.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"viewPluginConfig": { | ||
"pluginConfig": { | ||
"id": "Custom CMD example", | ||
"cancelOnResult": true, | ||
"ocrConfig": { | ||
"customCmdFile": "cow_tag_scanner.ale" | ||
} | ||
}, | ||
"cutoutConfig": { | ||
"animation": "none", | ||
"width": 400, | ||
"alignment": "top_half", | ||
"ratioFromSize": { | ||
"width": 4, | ||
"height": 5 | ||
}, | ||
"cropPadding": { | ||
"x": 20, | ||
"y": 20 | ||
}, | ||
"cornerRadius": 4, | ||
"strokeColor": "0099FF", | ||
"strokeWidth": 1, | ||
"outerAlpha": 0.3 | ||
}, | ||
"scanFeedbackConfig": { | ||
"style": "contour_rect", | ||
"visualFeedbackRedrawTimeout": 100, | ||
"strokeColor": "0099FF", | ||
"strokeWidth": 2, | ||
"fillColor": "220099FF", | ||
"beepOnResult": true, | ||
"vibrateOnResult": false | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.