iMZ320 in iOS:Sometimes getCurrentStatus shows ErrorCode=7

M Molay Ash 3 years 7 months ago
137 3 0

Hi,
We are trying to retrive printer current status inside a timer in iOS but sometimes we are receiving ErrorCode=7 .
 
We have done following:
 
1) First connecting the printer as shown in below sample code and it was successful.
 
                                   id connection; //It's a global variable
                connection = nil;
                connection = [[MfiBtPrinterConnection alloc] initWithSerialNumber:printerSerialNumber];
                [((MfiBtPrinterConnection*)connection) setTimeToWaitAfterWriteInMilliseconds:60];
                NSError *error = nil;
                BOOL didOpen = [connection open];
                if (didOpen) {
                    zebraPrinter = [ZebraPrinterFactory getInstance:connection error:&error];
                    if(error != nil) {
                        return;
                    }
                }
 
2) Then inside a timer, we are checking printer status as shown in below code sample:
 
                 id zebraPrinter;  //It's a global variable
        zebraPrinter = [ZebraPrinterFactory getInstance:connection error:&error];
        if(connection.isConnected)
        {
            PrinterStatus *status = [zebraPrinter getCurrentStatus:&error];
            if (error) {
                //Here SOMETIMES we are getting ErrorCode=7
                Error Domain=ZSDK_API_ERROR_DOMAIN Code=7 "Malformed status response - unable to      determine printer status" UserInfo={NSLocalizedDescription=Malformed status response - unable to determine printer status}
            }
        }
 
Please note:
 
- We are using latest zebra sdk (V1.5.1049)
- Printer Model: ZEBRA iMZ320
- iOS version 11.2.1
- We are NOT getting this error very frequently. But the error is there.
 
We have spend lots of time to find the exact reason (also sequence to re-prouce) of this error. But unable to find any proper solution.
Could you please let us know is there anything we are missing?
 
In advance thanks,
Molay

Please Register or Login to post a reply

3 Replies

Y Yanis Dalabiras

[Latest Update on 2/6/2018]: Apple has released iOS version v11.2.5. Our internal testing has indicated that v11.2.5 appears to have addressed the Bluetooth connection/disconnection issues previously seen in prior releases of iOS v11. We recommend that developers experiencing issues with Bluetooth disconnections in iOS v11 move their iOS devices to v11.2.5.

N Nicola Lazzara

I've the same problem on Xamarin.Forms Application. Printing is ok in IOS 11.2.1 but never work in IOS 11.2.2.

The error is "malformed status responde" on CheckPrinterStatus method.

My printer is Zebra IMZ320. I use LinkOS.Plugin version 1.1.75

How i can fix? I'm sure that only one thread is open and only 1 ipad is connect with printer.

Y Yanis Dalabiras

When "Malformed status response" error happens from getCurrentStatus:, it is usually due to two reasons: 1) the timeout from the Bluetooth stack, or 2) the corrupted status data received. When this happens, we can retry the getCurrentStatus:. Usually, it would succeed in the second time. There is no harm to try the status call multiple times. Besides the retry, we can also increase the wait time on the Bluetooth connection after read. The default timeout is set to 10ms. We can increase it to 20ms or 30ms to see if this resolves the "Malformed status response" error.
[connection setTimeToWaitAfterReadInMilliseconds:timeout];There could be a variety of reasons causing the timeout, such as high priority tasks in background or high priority threads in the current application somehow slowing down the Bluetooth stack. As you described that this error doesn't happen frequently, it sounds a timeout in a specific circumstance. Let's know if changing the timeout would prevent it from happening.

CONTACT
Can’t find what you’re looking for?