我正在寻找帮助在appcelerator中集成Captuvo SL22 SDK。 Captuvo SDK随附了用于ipod的Captuvo扫描仪/ msr。我试图在自定义模块中使用Captuvo SDK并在主应用程序中调用它。我可以使用自定义模块startDecoder方法中的以下代码与Captuvo设备建立连接:
- (IBAction)startDecoder:(id)sender {
ProtocolConnectionStatus state= [[Captuvo sharedCaptuvoDevice] startDecoderHardware];
NSString *mess=nil;
switch (state) {
case ProtocolConnectionStatusAlreadyConnected:
mess=@"already connected";
break;
case ProtocolConnectionStatusUnableToConnect:
mess=@"error connecting";
break;
case ProtocolConnectionStatusConnected:
mess=@"connecting";
break;
case ProtocolConnectionStatusUnableToConnectIncompatiableSledFirmware:
mess=@"incompatible firmware";
break;
case ProtocolConnectionStatusBatteryDepleted:
mess=@"battery depleted";
break;
default:
break;
}
{UIAlertView* alert = [[UIAlertView alloc]initWithTitle:nil
message:mess
delegate:self
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];}}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[[Captuvo sharedCaptuvoDevice] addCaptuvoDelegate:self];}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
}
return self;}
设备响应我连接没有错误,然后我使用下面的方法打开扫描仪:
- (IBAction)scanningBtn:(id)sender {
[[Captuvo sharedCaptuvoDevice] startDecoderScanning];}
不幸的是没有发生任何事情,我正试图按侧键,也没有任何事情发生......
IOS版本7.1.2 Xcode版本5.1
答案 0 :(得分:0)
试试这个:
在ViewController.h中:
@interface ViewController : UIViewController<CaptuvoEventsProtocol>
在ViewController.m中:
- (void)viewDidLoad
{
[super viewDidLoad];
[[Captuvo sharedCaptuvoDevice] addCaptuvoDelegate:self];
[[Captuvo sharedCaptuvoDevice] startDecoderHardware];
}
- (void)decoderReady
{
// called when scanner is ready (might take a second)
}
- (void)decoderDataReceived:(NSString *)barcode
{
// called when you press the side button and a barcode was scanned
}
在你的info.plist中添加这个键和数组:
...
<key>UISupportedExternalAccessoryProtocols</key>
<array>
<string>com.honeywell.scansled.protocol.decoder</string>
</array>
...
</dict>
</plist>
希望这会有所帮助......
答案 1 :(得分:0)
将霍尼韦尔SLed功能的扫描仪和MSR集成到您的应用程序中;请阅读CaptuvoSDK快速入门和发行说明。
CaptuvoSDK在这个zip包中也有简单的代码。