CS4070 iOS Integration sbtEventScannerAppeared never called

S Simon Hopkin 3 years 6 months ago
14 0 0

Hi,
I'm having some trouble integrating the scanner api into an iOS app.  My code is as follows:

class ZebraScanner : NSObject, ISbtSdkApiDelegate {
   
    var apiInstance : ISbtSdkApi = SbtSdkFactory.createSbtSdkApiInstance()
   
    override init() {
        super.init()
        apiInstance.sbtSetDelegate(self)
        apiInstance.sbtSetOperationalMode(Int32(SBT_OPMODE_ALL))
        apiInstance.sbtSubsribe(forEvents: Int32(SBT_EVENT_SCANNER_APPEARANCE | SBT_EVENT_SCANNER_DISAPPEARANCE | SBT_EVENT_SESSION_ESTABLISHMENT | SBT_EVENT_SESSION_TERMINATION | SBT_EVENT_BARCODE | SBT_EVENT_IMAGE | SBT_EVENT_VIDEO))
        apiInstance.sbtEnableAvailableScannersDetection(true)
    }
   
    func sbtEventScannerAppeared(_ availableScanner: SbtScannerInfo!) {
        print("ZebraScanner sbtEventScannerAppeared \(availableScanner)")
    }
   
    func sbtEventScannerDisappeared(_ scannerID: Int32) {
        print("ZebraScanner sbtEventScannerDisappeared \(scannerID)")
    }
   
    func sbtEventCommunicationSessionEstablished(_ activeScanner: SbtScannerInfo!) {
        print("ZebraScanner sbtEventCommunicationSessionEstablished \(activeScanner)")
    }
   
    func sbtEventCommunicationSessionTerminated(_ scannerID: Int32) {
        print("ZebraScanner sbtEventCommunicationSessionTerminated \(scannerID)")
    }
   
    func sbtEventBarcode(_ barcodeData: String!, barcodeType: Int32, fromScanner scannerID: Int32) {
        print("ZebraScanner sbtEventBarcode barcodeData:\(barcodeData), barcodeType:\(barcodeType), fromScanner: \(scannerID)")
    }
   
    func sbtEventBarcodeData(_ barcodeData: Data!, barcodeType: Int32, fromScanner scannerID: Int32) {
        print("ZebraScanner sbtEventBarcodeData barcodeData:\(barcodeData), barcodeType:\(barcodeType), fromScanner: \(scannerID)")
    }
   
    func sbtEventFirmwareUpdate(_ fwUpdateEventObj: FirmwareUpdateEvent!) {
        print("ZebraScanner sbtEventFirmwareUpdate \(fwUpdateEventObj)")
    }
   
    func sbtEventImage(_ imageData: Data!, fromScanner scannerID: Int32) {
        print("ZebraScanner sbtEventImage \(imageData), fromScanner: \(scannerID)")
    }
   
    func sbtEventVideo(_ videoFrame: Data!, fromScanner scannerID: Int32) {
        print("ZebraScanner sbtEventVideo \(videoFrame), fromScanner: \(scannerID)")
    }
   
   
}

I see from the logs that bluetooth peripherals are discovered but I'm never seeing a connected event and therefore my sbtEventScannerAppeared event method is never called.

The process I'm following is to run my app, then go to the bluetooth settings and connect to the CS4070.  I see that my iPhone connects to the scanner in the bluetooth settings and I then go back to my app.  Looking through the logs I never see a connection detection event.

If I try the example app and follow the same process it works fine.  I'm not sure what I'm doing wrong in my app, I have followed the API guide.  I can only assume the demo app is doing something that isn't mentioned in the API guide.

Any help on this would be much appreciated.

Kind Regards
Simon

CONTACT
Can’t find what you’re looking for?