Link-OS™ Multiplatform SDK for iOS v 1.3 issue

When using the newest version of the Link-OS™ Multiplatform SDK for iOS, a few developers have reported being unable to print images and/or text and receiving an “Unable to determine printer language” message.  If you encounter these errors, change the timeout on the MFi Bluetooth connection method setTimeToWaitAfterWriteInMilliseconds, from 10ms to a larger value like 30ms or higher to resolve the issue.

 

Here is an example of how to make this change:

// Establish the connection. 

connection = [[MfiBtPrinterConnection alloc] initWithSerialNumber:serialIP ];

// Change the the Time to wait after write from the default of 10ms to 30ms

        [((MfiBtPrinterConnection*)connection) setTimeToWaitAfterWriteInMilliseconds:30];

Joaquin vt9yxeu...
HiI have gotten with the same

Hi

I have gotten with the same error message ...

@"Unable to determine printer language"

And I add your line but I continue with the error, any ideas?

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Kian 20p0q02gy3...
Ditto that. I'm currently

Ditto that. I'm currently facing this issue as well. Will installing the latest firmware on the printer fix this issue?

EDIT: So I answered my own question. I updated the firmware on one of the printers we have here and the issue continues to haunt us. It prints okay for a couple of pages and then the "Unable to determine printer language" error occurred. Note that I send the print commands to the printer as a single job.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Daniel Quagliana
An updated Link-OS
Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Tobias Haehnel,...
Hello, I've the same error. I

Hello, I've the same error. I updated the API with the files from the new SDK you mentioned.

But I still get the error. I also used the code line: [((MfiBtPrinterConnection*)connection) setTimeToWaitAfterWriteInMilliseconds:30]; after initializing the connection, but no effect.

What can I do else?

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Hi Tobias,It appears that

Hi Tobias,

It appears that many people are seeing the same or a similar issue so I am working to replicate and test code etc. here. I will let you know what I find out.

What printer are you using and what firmware does it have on it? What version of Xcode are you running? What iOS device are you testing wth and what iOS version does it have on it? I want to gather this data to compare the issues between users and with what I am testing with.

Thank you,

Beverly

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Tobias Haehnel,...
Hello,I’m using printer ZQ

Hello,

I’m using printer ZQ-520 with Firmware V76.19.13Z. Xcode Version 7.1.1 (7B1005) an Objective C with ARC Target Version 8.0 on iPad Mini 1 with iOS 9.1

Best Regards,

Tobias

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Tobias,Thank you, I also

Tobias,

Thank you, I also meant to ask if you could share your code where you are making the BT connection, sending the data down to be printed etc. so I can take a look at it.

Thank you,

Beverly

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Tobias Haehnel,...
- (void


- (void)establishBluetoothConnection

{

   

    NSLog(@"%s", __PRETTY_FUNCTION__);

   

    //Dispatch this task to the default queue

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^ {

   

        NSString *serialNumber = @"";

       

        //Find the Zebra Bluetooth Printer and get serial number

       

        EAAccessoryManager *accessoryManager = [EAAccessoryManager sharedAccessoryManager];

        NSArray *connectedAccessories = [accessoryManager connectedAccessories];

       

        for (EAAccessory *accessory in connectedAccessories) {

            if ([accessory.protocolStrings indexOfObject: ZebraProtocolIdentifier] != NSNotFound) {

                serialNumber = accessory.serialNumber;

                break;

                //Note: This will find the first printer connected! If you have multiple Zebra printers connected, you should display a list to the user and have him select the one they wish to use

            }

        }

       

        dispatch_async(dispatch_get_main_queue(), ^{

       

            [self establishBluetoothConnectionToDeviceWithSerialNumber:serialNumber];

        });

    });

}

- (void)establishBluetoothConnectionToDeviceWithSerialNumber:(NSString*)serialNumber

{

    NSLog(@"%s", __PRETTY_FUNCTION__);

   

    //Dispatch this task to the default queue

    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^ {

       

        NSLog(@"Serialnumber: %@", serialNumber);

       

        // Instantiate connection to Zebra Bluetooth accessory with serial number

        self.zebraPrinterConnection = [[MfiBtPrinterConnection alloc] initWithSerialNumber:serialNumber];

       

//        //BugFix: Due to https://developer.motorolasolutions.com/thread/29893

        [((MfiBtPrinterConnection*)self.zebraPrinterConnection) setTimeToWaitAfterWriteInMilliseconds:80];

       

        // Open the connection - physical connection is established here.

        BOOL success = [self.zebraPrinterConnection open];

        NSLog(@"Zebra Printer Connection open: %d", success);

       

        // Get printer

        NSError *error = nil;

        self.printer = [ZebraPrinterFactory getInstance:self.zebraPrinterConnection error:&error];

       

        if (error != nil) {

            NSLog(@"Error: %@", error.localizedDescription);

        }

       

        if (self.printer == nil) {

            NSLog(@"Printer is nil");

            [self.zebraPrinterConnection close];

            self.zebraPrinterConnection = nil;

        } else {

            [self sendPrinterConfiguration];

        }

       

        dispatch_async(dispatch_get_main_queue(), ^{

            if (self.printer != nil) {

                [self.zebraDirectPrintDelegate printerConnectionEstablished];

            } else {

                [self.zebraDirectPrintDelegate printerConnectionNotEstablished];

            }

        });

    });

}

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Hi Tobias,We have been trying

Hi Tobias,

We have been trying to reproduce this issue. Below are some possible issues that we've seen to cause the issue and things to look for in your code. 

The first things you want to look at are to make sure you are using the newest SDK and printer firmware.   We fixed a Bluetooth connection timing issue in the iOS v1.4.948 of the SDK.  The newest printer firmware version, vXX.19.13Z, also has a bug fix with Bluetooth connection handshaking.  To ensure the new settings are in effect, use the following command:

[SGD SET:@"bluetooth.page_scan_window" withValue:@"60" andWithPrinterConnection:connection error:&error];

With the code you provided we extrapolated what we think is happening with our ZSDKDeveloperDemos sample.  We can only cause the error when we are trying to perform some actions at the same time.  Below is a snippet from the SDK Connectivity demo. Our demo disables the “Test Connectivity” button once it is pressed to disallow re-entery into this code path until it is completed. Not doing so can cause the “Unable to determine printer language” error message if the user presses the button before the previous process is completed completely.   This could be what you are seeing.

-(void) performConnectionDemo {

     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

     self.performingDemo = YES;

     [self.testButton setEnabled:NO];// <-- VERY IMPORTANT TO AVOID RE-ENTERING PROCESS PREMATURELY

     [self.connectivityViewController setStatus:@”Connecting…” withColor:[UIColor yellowColor]];

     id<ZebraPrinterConnection, NSObject> connection = nil;

     if(self.connectivityViewController.isBluetoothSelected {

          connection = [[[MfiBtPrinterConnection alloc] initWithSerialNumber:self.connectivityViewController.bluetoothPrinterLabel.text] autorelease];

Another situation that can occur is an unexpected connection problem between the iOS device and the printer. If this should occur after the SDK makes the Bluetooth connection to the printer, but before the ZebraPrinterFactory getInstance() call, this error will occur. That’s how we generated the error shown below.

2015-12-15 16:00:59.276 ZSDKDeveloperDemos[474:92427] Error: Unable to determine printer language

Let us know if any of these things are helpful!

Robin

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Hi Kian,It appears that many

Hi Kian,

It appears that many people are seeing the same or a similar issue so I am working to replicate and test code etc. here. I will let you know what I find out.

What printer are you using and what firmware does it have on it? What version of Xcode are you running? What iOS device are you testing wth and what iOS version does it have on it? I want to gather this data to compare the issues between users and with what I am testing with.


Would you also be able to share your code where you make the BT connection, send the print data down etc.?


Thank you,

Beverly

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Kian 20p0q02gy3...
Hi , We have two iMZ320s over

Hi ,

We have two iMZ320s over at our site. They came with firmware V73.19.10Z. As I mentioned in my previous reply, I upgraded one of them to V73.19.13Z which didn't solve the issue.

I've not tested out the latest Link-OS SDK, but I think I managed to solve this issue by sending the print job to the printer as "many print jobs", i.e. receipt header as one print job, receipt date/time as another job, receipt column titles as another print job, etc.

The only time this bug appears is when I try to send the print job as one job; breaking up the large strings into smaller chunks doesn't help at all.

One thing I did differently from the sample code is to close the connection only when I'm about to start a new print job. I did it this way as I noticed closing the connection after sending the last print job of the batch causes the printer to stop printing immediately, although the print job has yet to be finished.

I hope this helps narrow down your investigations.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Hi Kian, I'm glad you found a

Hi Kian,

I'm glad you found a work around but it is a bit odd.   Have you gotten a chance to try it with the newest SDK? 

Let us know,

Robin

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Billy goforth
Hello,I'm needing some

Hello,

I'm needing some assistance with a similar, but not quite the same issue. I have a ZQ520 that I'm able to establish a connection to, but when the code finishes the test print using a simple string (from example code) in ZPL format, it throws an error of "Error writing to connection". Here is the code I'm using from the MfiBtPrinterConnection API SDK v 1.4.948

-(void)sendZplOverBluetooth:(CDVInvokedUrlCommand*)command{

NSString *serialNumber = @"";

//Find the Zebra Bluetooth Accessory

EAAccessoryManager *sam = [EAAccessoryManager sharedAccessoryManager];

NSArray * connectedAccessories = [sam connectedAccessories];

for (EAAccessory *accessory in connectedAccessories) {

  if([accessory.protocolStrings indexOfObject:@"com.zebra.rawport"] != NSNotFound){

  serialNumber = accessory.serialNumber;

  break;

  //Note: This will find the first printer connected! If you have multiple Zebra printers connected, you should display a list to the user and have him select the one they wish to use

  }

  }

// Instantiate connection to Zebra Bluetooth accessory

id<ZebraPrinterConnection, NSObject> thePrinterConn = [[MfiBtPrinterConnection alloc] initWithSerialNumber:serialNumber];

// Open the connection - physical connection is established here.

BOOL success = [thePrinterConn open];

// This example prints "This is a ZPL test." near the top of the label.

NSString *zplData = @"^XA^FO20,20^A0N,25,25^FDThis is a ZPL test.^FS^XZ";

NSError *error = nil;

// Send the data to printer as a byte array.

  success = success && [thePrinterConn write:[zplData dataUsingEncoding:NSUTF8StringEncoding] error:&error];

if (success != YES || error != nil) {

UIAlertView *errorAlert = [[UIAlertView alloc] initWithTitle:@"Error" message:[error localizedDescription] delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil];

  [errorAlert show];

// [errorAlert release];

  }

// Close the connection to release resources.

  [thePrinterConn close];

// [thePrinterConn release];

}

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments