Honeywell's Captuvo SL22 SDK

2019-07-02 13:42发布

I am looking for help in integrating Captuvo SL22 SDK within appcelerator. The Captuvo SDK comes with the Captuvo scanner/msr for ipod. I am trying to use Captuvo SDK in a custom module and call it in the main app. I am able to establish a connection with the Captuvo Device by using the following code in the custom module startup method:

-(void) startup{
    self.captuvo = [Captuvo sharedCaptuvoDevice];
    [self.captuvo addCaptuvoDelegate:self];
    [self.captuvo startDecoderHardware];
}

-(void) DecoderReady{
    //Fire Event successfully to Titanium App
}

After the startup I try to turn the scanner on by hitting a button in the app, this is my code:

-(void) turnScannerOn{
    if([self.captuvo isDecoderRunning]){
        //Fire event successfully to Titanium App
        [self.captuvo startDecoderScanning];
    }
}

However, no matter what I try I cannot get the scanner to turn on for the life of me. I am using Titanium 3.1.1 for an iPod touch running iOS 6.1. Any help would be much appreciated! If I figure it out I will be sure to let others know!

Update: So an update on this is that I was able to get the this to kind of work. This to the tiapp.xml to scan:

<ios>
    <plist>
        <dict>
            <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>
        </dict>
    </plist>
</ios>

However, when you first startup the app, I am unable to turn on the scanner using a button, but the triggers on the side work, but no data is returned. Honeywell provided some sample code and I noticed that this code added to a native app makes the scanner work on the initial start up so I was wondering if there is a way to replicate this objective C code inside of titanium:

- (void)viewWillAppear:(BOOL)animated
{
    [[Captuvo sharedCaptuvoDevice] removeCaptuvoDelegate:self] ;
    [[Captuvo sharedCaptuvoDevice] addCaptuvoDelegate:self];
    [[Captuvo sharedCaptuvoDevice] startPMHardware];
    [[Captuvo sharedCaptuvoDevice] startDecoderHardware];
}

- (void)viewDidDisappear:(BOOL)animated
{
    [[Captuvo sharedCaptuvoDevice] stopDecoderHardware];
    [[Captuvo sharedCaptuvoDevice] stopPMHardware];
    [[Captuvo sharedCaptuvoDevice] removeCaptuvoDelegate:self];
}

5条回答
欢心
2楼-- · 2019-07-02 14:13

When you start use the Honeywell's Captuvo SDK, you need read the quick start and release notes first, that will help you quick start develop you self application base CaptuvoSDK for SL22/SL42/SL62

查看更多
成全新的幸福
3楼-- · 2019-07-02 14:23

@Chris For ur update question , i have wrote same code like u , stop stopDecoderHardware in viewWillDiseappear and startDecoderHardware in viewWillAppear , then no data gets occasionaly but the light is always OK,so i guessd there are some problems caused by the start and stop ,then i removed all stopDecoderHardware and startDecoderHardware methods in my viewController , just retain the addDelegate and removeDelegate methods, and modify the method in AppDelegate.m file like below

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    [[Captuvo sharedCaptuvoDevice] startDecoderHardware];
}  
- (void)applicationDidEnterBackground:(UIApplication *)application
{
    [[Captuvo sharedCaptuvoDevice] stopDecoderHardware];
}  

yep,wasting batteries maybe,but it seems that solving the problem that no data gets

查看更多
\"骚年 ilove
4楼-- · 2019-07-02 14:33

Make sure you have the "Supported external accesories" key set in the info.plist as follows:

<string>com.honeywell.scansled.protocol.decoder</string>
<string>com.honeywell.scansled.protocol.msr</string>
<string>com.honeywell.scansled.protocol.pm</string>
查看更多
贪生不怕死
5楼-- · 2019-07-02 14:33

Remove the check for isDecoderRunning. If you haven't started the decoder, it will never return true, and you will never reach the code where you are starting the decoder.

Also, make sure you are starting both the barcode and the MSR:

    [self.captuvo startDecoderScanning];
    [self.captuvo startMSRHardware];

I would also recommend doing this:

    connectionStatus = [captuvo startDecoderHardware];
    switch (connectionStatus) {
        case ProtocolConnectionStatusConnected:
        case ProtocolConnectionStatusAlreadyConnected:
            NSLog(@"Connected!");
            break;
        case ProtocolConnectionStatusBatteryDepleted:
            NSLog(@"Battery depleted!");
            break;
        case ProtocolConnectionStatusUnableToConnect:
            NSLog(@"Error connecting!");
            break;
        case ProtocolConnectionStatusUnableToConnectIncompatiableSledFirmware:
            NSLog(@"Incompatible firmware!");
            break;
        default:
            break;
    }

That way you can check what happened when trying to connect.

查看更多
成全新的幸福
6楼-- · 2019-07-02 14:33

This post is getting old, but I thought I'd put my 2 cents in to help out if anyone else stumbles upon this question.

I've found that I need to call startDecoderHardware on the main UI thread or I won't get barcode scan callbacks. I spent a lot of time fighting this before I figured that out.

查看更多
登录 后发表回答