How do I use the Linea-Pro SDK for IOS?

后端 未结 3 514
谎友^
谎友^ 2020-12-23 22:33

Does anyone know of or have a manual on how to script in xcode with the linea-pro.

I have hunted the web and asked Infinite Peripherals for help but no reply.

<
3条回答
  •  北荒
    北荒 (楼主)
    2020-12-23 23:01

    Import the .a and .h file

    Add ExternalAccessory.framework

    open your info.plist file as source code and add the following lines:

    UIBackgroundModes
    
        external-accessory
    
    UISupportedExternalAccessoryProtocols
    
        com.datecs.linea.pro.msr
        com.datecs.linea.pro.bar
        com.datecs.printer.escpos
        com.datecs.iserial.communication
        com.datecs.pinpad
    
    

    Add to your interface like this:

    @interface ViewController : UIViewController 
    

    In your .h file of your ViewController add the DTDevices object

    @interface ViewController : UIViewController 
    {
        DTDevices *scanner;
    }
    

    In the ViewDidLoad function, add the connection code:

     scanner=[DTDevices sharedDevice];
    [scanner addDelegate:self];
    [scanner connect];
    

    Get connection status by adding this method to your code:

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

    Hope this helps.

提交回复
热议问题