For Picqer we are experimenting with barcode scanner sleds. (You can connect it to a iOS device and use it in warehouses instead of old and expensive Windows CE devices.)
After reviewing the Honeywell Captuvo’s and the Linea Pro’s, we decided to try the Captuvo’s first.
Easy SDK
The SDK looked very easy to use. Drop in 2 libraries, write 5-6 lines of code and it should work.
But after a day of trying I could not get it to work. Also my colleague @stephangroen ran into the same problems the day after. We could retrieve the serial number and battery status. But after we ‘start’ the barcode scanner, the lights stay out.
So frustrating.
The missing plist entry
At the end of the second day I found an abandoned forum with an extra entry to the Info.plist. Looked like exactly something we were missing. We tried it in 2 minutes and now it worked. And it worked flawlessly.
The missing entry, add this to your main Info.plist:
<key>UISupportedExternalAccessoryProtocols</key>
<array>
<string>com.honeywell.scansled.protocol.decoder</string>
</array>
The plist entry is never mentioned in the docs. Also the docs are too much text for some really easy steps. So perfect for this first blog post to create a comprehansive how-to. 🙂
Complete how-to
These are the minimum steps to get the Honeywell Captuvo to work in your iOS project:
- Get the Captuvo SDK from honeywellaidc.com, you can download it directly after you fill in the form
- Drag the Captuvo.h file into the file tree on the left in Xcode (in the pop-up check ‘copy items if needed’ and all targets)
- To the same with the libCaptuvoSDK.a file
- Go to your project settings (click the first item in the file tree), click on the General tab, at Linked Frameworks and Libraries add ExternalAccessory.framework
- Open the Info.plist and add “Supported external accessory protocols” key as an array with item 0 as string with the contents “com.honeywell.scansled.protocol.decoder”
- Open AppDelegate.h and add ‘#import “Captuvo.h”’ at the top and add “CaptuvoEventsProtocol” as extra delegate, like this:
#import <UIKit/UIKit.h>
#import "Captuvo.h"
@interface AppDelegate : UIResponder <UIApplicationDelegate,CaptuvoEventsProtocol>
@property (strong, nonatomic) UIWindow *window;
@end
- Open AppDelegate.m and add the following code:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[[Captuvo sharedCaptuvoDevice] addCaptuvoDelegate:self];
[[Captuvo sharedCaptuvoDevice] startDecoderHardware] ;
}
-(void)decoderDataReceived:(NSString *)data{
UIAlertView* alert = [[UIAlertView alloc]initWithTitle:nil
message:data
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
Now you can build your app, put it on a iOS device and it should work. You now get a UIAlert for every barcode you scanned.
Hope this helps the next developer wasting a day 🙂 If you have any questions regarding this, ping me on twitter: @casperbakker