如何在IOS中使用Linea-Pro SDK?

Chr*_*man 16 objective-c ios xcode4.5 linea-pro

有没有人知道或有一本关于如何使用linea-pro在xcode中编写脚本的手册.

我已经在网上搜索并向Infinite Peripherals寻求帮助但没有回复.

我找到了一个".a"和".h"文件,看起来像是有所有代表团等,但我不知道如何操作一些功能.

如果您需要更多信息,请询问.

Mut*_*thu 26

提供对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.
Run Code Online (Sandbox Code Playgroud)

1)在Classes文件夹下的项目中包含"LineaSDK.h"和"libdtdev.a".

2017更新:从developer.ipcmobile.com下载最新的DTDEVICES SDK.截至2017年1月,最新版本为v2.01,支持Linea Pro 7以外的设备.

2)在项目中"添加现有框架".

  1. 在项目导航器中,选择您的项目
  2. 选择目标.
  3. 选择"构建阶段"选项卡
  4. 打开'Link Binaries With Libraries'扩展器
  5. 单击"+"按钮
  6. 选择"外部附件框架"
  7. 将添加的框架拖放到"框架"组

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>
Run Code Online (Sandbox Code Playgroud)

4)在MainViewController.m文件中编写代码

//对init linea类很重要并连接它

- (void)viewDidLoad
{
    // init linea class and connect it    
    linea =[Linea sharedDevice];
    [linea addDelegate:self];
    [linea connect];    

    [super viewDidLoad];
}
Run Code Online (Sandbox Code Playgroud)

//成功读取barode数据后调用

-(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);
}
Run Code Online (Sandbox Code Playgroud)

注意:将 'LineaSDK.h'导入MainViewController.h并声明

Linea* linea;
Run Code Online (Sandbox Code Playgroud)

变量.

它工作得很好.

  • 你找到了调试的方法吗?当我通过USB电缆将设备连接到Mac时,设备将无法连接到iPhone.如果我取下电缆并运行应用程序,设备会立即连接到iPhone.如果在运行应用程序时无法连接到Mac,如何进行调试?我真的不敢相信他们希望我们回到调试应用程序中的消息,以便在iPhone上显示它们. (4认同)

Lee*_*Lee 10

导入.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>
Run Code Online (Sandbox Code Playgroud)

<DTDeviceDelegate>像这样添加到您的界面:

@interface ViewController : UIViewController <DTDeviceDelegate>
Run Code Online (Sandbox Code Playgroud)

在ViewController的.h文件中添加DTDevices对象

@interface ViewController : UIViewController <DTDeviceDelegate>
{
    DTDevices *scanner;
}
Run Code Online (Sandbox Code Playgroud)

在ViewDidLoad函数中,添加连接代码:

 scanner=[DTDevices sharedDevice];
[scanner addDelegate:self];
[scanner connect];
Run Code Online (Sandbox Code Playgroud)

通过将此方法添加到代码中来获取连接状态:

-(void)connectionState:(int)state {
    switch (state) {
    case CONN_DISCONNECTED:
               //Disconnected
               break;
    case CONN_CONNECTING:
        //Connecting
        break;
    case CONN_CONNECTED:
                 //Connected
                 break;
      }
   }
Run Code Online (Sandbox Code Playgroud)

希望这可以帮助.


Way*_*man 3

我假设您想要使用他们的 iPhone/iPod Touch sled 开发一个应用程序。最好的选择是查看他们的 SDK 中包含的示例 Xcode 项目。这将演示如何与雪橇连接,以及设置与硬件交互的不同选项,例如它应该查找的条形码类型(如果您使用的是 2D 扫描仪)、它应该发出的任何硬件声音, ETC。

他们的基本假设是您是一位经验丰富的 iOS 开发人员,并且您已准备好开始与他们的 SDK 集成。听起来您是 iOS 开发新手,我鼓励您在做一些更高级的事情(例如与硬件外设交互)之前先积累经验。

在较高的层面上,您需要:

  1. 创建一个新的 Xcode 项目并将其 .a 和 .h 文件放入您的项目中。
  2. 导入几个必需的框架,我能立即记住的唯一一个是ExternalAccessory.framework.
  3. 调用共享实例与硬件连接并交互。