Honeywell's Captuvo SL22 SDK

你。 提交于 2019-12-23 21:25:31

问题


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];
}

回答1:


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>



回答2:


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.




回答3:


@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




回答4:


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.




回答5:


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



来源:https://stackoverflow.com/questions/18084791/honeywells-captuvo-sl22-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!