-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancements for image scanning #29
base: master
Are you sure you want to change the base?
Changes from 1 commit
123db70
d45480b
1fe5007
bf3a412
6818ba2
23bdff1
983f0e7
b421cbf
d1aa2e2
0a6a2dc
f8d2115
4ffd5b1
dfcffa3
db19019
72f22f6
c7fef38
0158181
9510a16
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,7 +50,7 @@ class ScannerController: NSObject, ICScannerDeviceDelegate { | |
guard error == nil else { | ||
logger.log("Error received while attempting to open a session with the scanner.") | ||
delegate?.scannerControllerDidFail(self) | ||
return | ||
exit(1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In a batch scan, would this change the current behavior? Wondering if there's an issue where you're scanning several items in a batch and then one of them fails -- would it exit now instead of bailing on that particular item and continuing on? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point! I haven't thought of that use case. I just found it confusing that the command did not exit when encountering an error. Instead it kept running forever. To be safe I added a fallback to return for the batch scan case now. |
||
} | ||
} | ||
|
||
|
@@ -76,7 +76,7 @@ class ScannerController: NSObject, ICScannerDeviceDelegate { | |
// NOTE: Despite the fact that `functionalUnit` is not an optional, it still sometimes comes in as `nil` even when `error` is `nil` | ||
if functionalUnit != nil && functionalUnit.type == self.desiredFunctionalUnitType { | ||
configureScanner() | ||
logger.log("Starting scan...") | ||
logger.verbose("Starting scan...") | ||
scanner.requestScan() | ||
} | ||
} | ||
|
@@ -93,7 +93,7 @@ class ScannerController: NSObject, ICScannerDeviceDelegate { | |
guard error == nil else { | ||
logger.log("ERROR: \(error!.localizedDescription)") | ||
delegate?.scannerControllerDidFail(self) | ||
return | ||
exit(1) | ||
} | ||
|
||
if self.configuration.batchScan { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,3 @@ let appController = ScanlineAppController(arguments: CommandLine.arguments) | |
appController.go() | ||
|
||
CFRunLoopRun() | ||
|
||
print("Done") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Curious why this was removed... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For my taste this was just too verbose. I would expect a terminal command to just do it's job and exit with 0 exit code when it is done. Exit code != 0 for failures and according error message on stderr when something failed. Or is there some use case for it that I am missing? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair enough... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should be necessary. If I revert it back to
#import "ScanConfiguration.h"
, I'm able to run the tests. Although I also had to remove the app source files from the test target, which they shouldn't have been in. Maybe that was the issue here?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. When I revert the change I get
'ScanConfiguration.h' file not found
. Removing the source files from CompileSources of the Test target unfortunately does not fix things for me:However I'm not very familiar with XCode nor the Swift build system. Any ideas?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was able to get it to work by doing the following:
#import "ScanConfiguration.h"
inScanConfigurationTests.m
ScanConfigurationTests.m
andScanConfiguration.m
from theCompile Sources
step#import "scanline-Swift.h"
fromScanConfiguration.m
It's not ideal -- we shouldn't need any of the app source files in the test target -- but I'm not sure what the issue is right now with that.