Configuration

  1. Drag honeywell sdk into your project, you should be able to see libCaptuvoSDK.a been added into your general, linked frameworks and libraries

  2. In general, linked frameworks and libraries, add ExternalAccessory.framework

  3. In Info.plist file, add

    <key>UISupportedExternalAccessoryProtocols</key>
    <array>
        <string>com.honeywell.scansled.protocol.decoder</string>
        <string>com.honeywell.scansled.protocol.msr</string>
        <string>com.honeywell.scansled.protocol.pm</string>
    </array>

How to use

In AppDelegate (App level)

  • Add CaptuvoEventsProtocol in AppDelegate class
class AppDelegate: UIResponder, UIApplicationDelegate, CaptuvoEventsProtocol {...}
  • Override funcs in CaptuvoEventsProtocol
func captuvoConnected() {
    Captuvo.sharedCaptuvoDevice().startDecoderHardware()
}

func captuvoDisconnected() {

}
  • In didFinishLaunchingWithOptions
Captuvo.sharedCaptuvoDeviceDebug().addCaptuvoDelegate(self)
Captuvo.sharedCaptuvoDevice().startDecoderHardware()    
  • In applicationDidEnterBackground
Captuvo.sharedCaptuvoDevice().stopDecoderHardware()    
  • In applicationWillEnterForeground
Captuvo.sharedCaptuvoDevice().startDecoderHardware()

In ViewController (ViewController level)

  • Enable device delegate
override func viewWillAppear(animated: Bool) {
    super.viewWillAppear(true)
    Captuvo.sharedCaptuvoDeviceDebug().addCaptuvoDelegate(self)
}

override func viewWillDisappear(animated: Bool) {
    super.viewWillDisappear(true)
    Captuvo.sharedCaptuvoDeviceDebug().removeCaptuvoDelegate(self)
}
  • Receive barcode reading
func decoderDataReceived(data: String!) {
    self.myUITextField.text = data //fill up into UITextField
    self.submitAction("")   //auto click submit btn
}