Random CR/LF inserted in the data when communicating via Bluetooth using the Zebra Mobile Printer SDK

Article ID: 96612560

Details


 

Topic or Information

Unwanted CR/LF is added to the data when communicating via Bluetooth using the Zebra SDK

Applies To

  • Using the SDK communicating via Bluetooth
  • Zebra Mobile printers used in line print mode


Details

Sending data to the QL Plus printer using the Write(byte[] data) method of the BT portion of the SDK results in an extra line feed occurring after every 666 bytes of data.  

The cause of this issue is the printer’s built-in line print timeout  When the printer is in line print mode it is expecting a CrLf termination following every batch of characters, after which it will print the characters received. However, if this termination is not received the printer will insert its own termination. Without this termination indication the printer could hang or appear locked up.

Resolution

 In order to resolve the issue you can adjust the printer’s SETLP-TIMOUT parameter to a higher value. The default value at power on is 4 (~ 500ms). Setting the value to somewhere around 12-14 should suffice.  The value is persistent until a power cycle or changed with the CPCL SETLP-TIMEOUT command.

Note: Setting the SETLP-TIMOUT command to a value of 0 disables the line print timeout, and characters will be held forever until a terminator is received. We do not recommend a setting of zero unless the environment is well controlled.

Changing the Timeout Value

Send this command directly to the printer - 

! U1 SETLP-TIMEOUT 14<CR><LF> <— command must be followed by a carriage return / line feed termination 

Send test data to verify there are no more interjected CrLf in the data stream and the printed output. You can add this command into your data directly, or you can add it to a configuration file that is read on startup such as CONFIG.SYS, AUTOEXEC.BAT, or RUN.BAT. Here is an example using CONFIG.SYS: 

! DF CONFIG.SYS 
! UTILITIES 
SETLP-TIMEOUT 14 
PRINT 

<CR><LF> <— PRINT command must be followed by a carriage return / line feed termination in the file being sent to the printer 

You can send this file to the QL Plus using the Zebra Setup Utilities' ‘Send File’ option in the ‘Action’ tab of the ‘Tools’ dialog as well.

Source

Arthur P