有人知道或者有没有一份使用Linea-Pro在Xcode中编写脚本的手册。
我在网上搜寻且向Infinite Peripherals寻求帮助但没有得到回复。
我找到了一个".a"和".h"文件,它们看起来具有所有的委托等内容,但我不知道如何执行其中的某些函数。
如果你需要更多信息,请问我。
有人知道或者有没有一份使用Linea-Pro在Xcode中编写脚本的手册。
我在网上搜寻且向Infinite Peripherals寻求帮助但没有得到回复。
我找到了一个".a"和".h"文件,它们看起来具有所有的委托等内容,但我不知道如何执行其中的某些函数。
如果你需要更多信息,请问我。
提供Linea设备系列的访问。
为了在您的程序中使用Linea,需要执行几个步骤。这些步骤来自2011年,可能在2017年有所改变,但出于历史目的,在此展示:
- Include LineaSDK.h and libdtdev.a in your project.
- Go to Frameworks and add ExternalAccessory framework
- Edit your program plist file, add new element and select
"Supported external accessory protocols" from the list, then add two items to it -
‘com.datecs.linea.pro.msr’ and ‘com.datecs.linea.pro.bar’
- Write code in MainViewController.m file to connect and retrieve barcode data.
1) 在Classes文件夹下将“LineaSDK.h”和“libdtdev.a”文件包含到您的项目中。
2017年更新:从developer.ipcmobile.com下载最新的DTDEVICES SDK。截至2017年1月,最新版本为v2.01,支持Linea Pro 7设备。
2) 将“现有框架”添加到您的项目中。
3) 编辑您的项目.plist文件
<key>Supported external accessory protocols</key>
<value>
<array>
<string>com.datecs.linea.pro.msr</string>
<string>com.datecs.linea.pro.bar</string>
</array>
</value>
4) 在MainViewController.m文件中编写代码
// 初始化linea类并连接它是很重要的
- (void)viewDidLoad
{
// init linea class and connect it
linea =[Linea sharedDevice];
[linea addDelegate:self];
[linea connect];
[super viewDidLoad];
}
// 成功读取条形码后调用
-(void)barcodeData:(NSString *)barcode type:(int)type {
// You can use this data as you wish
// Here I write barcode data into the console
NSLog(@"Barcode Data: %@”, barcode);
}
Linea* linea;
变量。
它非常有效。
导入 .a 和 .h 文件
添加 ExternalAccessory.framework
以源代码形式打开您的 info.plist 文件并添加以下行:
<key>UIBackgroundModes</key>
<array>
<string>external-accessory</string>
</array>
<key>UISupportedExternalAccessoryProtocols</key>
<array>
<string>com.datecs.linea.pro.msr</string>
<string>com.datecs.linea.pro.bar</string>
<string>com.datecs.printer.escpos</string>
<string>com.datecs.iserial.communication</string>
<string>com.datecs.pinpad</string>
</array>
<DTDeviceDelegate>
添加到您的接口中,如下所示:
@interface ViewController : UIViewController <DTDeviceDelegate>
@interface ViewController : UIViewController <DTDeviceDelegate>
{
DTDevices *scanner;
}
scanner=[DTDevices sharedDevice];
[scanner addDelegate:self];
[scanner connect];
通过将以下方法添加到您的代码中来获取连接状态:
-(void)connectionState:(int)state {
switch (state) {
case CONN_DISCONNECTED:
//Disconnected
break;
case CONN_CONNECTING:
//Connecting
break;
case CONN_CONNECTED:
//Connected
break;
}
}
ExternalAccessory.framework
。