Desktop and kiosk ticket printers HomeAboutPrintersTicketsSalesSupportSupport

BocaSystems

Communications Overview and Sample Code

 

PRINTER CONFIGURATION - FGL vs. PCL4
BOCA printers are factory configured for either FGL or PCL4 operation. FGL mode is discussed in great detail in the programming guide.  PCL4 mode is described in the "Windows Compatibility Supplement".  Please note that the printer cannot alternate between these two modes.  PCL4 is primarily a legacy configuration for printers purchased before the development of the FGL printer drivers.  We strongly discourage the use of PCL4 drivers for new applications.


COMMUNICATING WITH YOUR PRINTER

There are a number of ways to communicate with a BOCA printer.  The simplest way to communicate with your BOCA printer is to open a port (parallel, serial) and to write directly to the port. This method will work with any PC while supporting full bi-directional communication on the serial port.  However, we recommend avoiding both of these interfaces for new applications as parallel and serial ports are no longer provided on computers.

 

The second means of communicating with a BOCA printer is over the Network via the Ethernet interface (see Ethernet page).  The network interface can be designed for full bi-directional communication and is the only means of working with a printer independent of a PC.

 

The final approach is to communicate with the printer using a driver.  There are two types of drivers – printer driver and HID device driver.  The printer driver (see printer driver page) interprets the data from the application and writes to the port (parallel, serial, USB or Ethernet).  BOCA provides printer drivers for all active Windows platforms, Linux and Macs.  These drivers only work with standard BOCA printers built from 2000 forward.  (Older software such as FGL II, IV, 20, 40, 21 and 41 will not operate with these drivers.  FGL22/42 rev C and above and all FGL24/44, FGL26/46 are compatible.) The Generic Text Printer Driver (in Windows) can be used for text based applications on older printer models which do not support the FGL drivers.  However, the generic text driver has limited capabilities and does not support certain functions such as graphics and true type fonts. 

 

The HID driver is automatically installed when the printer is configured as a USB HID device.  When operating in this mode, the HID driver passes all data directly to and from the printer without any interpretation.  (You cannot use a printer driver when operating as a USB HID device.)

 

NOTE:  All USB printers are factory preset to operate with printer drivers.  To configure the printer to act as a USB HID device, you need to use the control panel or one of the printer test programs on the Ghostwriter News page.

 

 

SAMPLE CODE

We have prepared a collection of code samples to demonstrate how to communicate bi-directionally with your printer with and without drivers on a variety of operating systems.

 

 

Bi-directional Communication Projects without Printer Drivers

You can communicate bi-directionally on USB/HID, Ethernet, Parallel and Serial interfaces without the use of printer drivers. The following sample code projects written in Xojo (Mac, Linux) and C# can be used in developing bi-directional communication with a Boca Systems printer. Please note that no printer driver (of any manufacturer) can be installed on the port that you intend to use for bi-directional communication.

 

 

Interface

Xojo (Mac)

Xojo (Linux)

USB

mac_sample.zip

 

Ethernet

mac_sample.zip

  linux_sample

 


Bi-directional Communication Projects with Printer Drivers

While our printer drivers do not support bi-directional communication, there are ways of bypassing the driver for querying and receiving status. We have provided sample files in Xojo (Mac) for accomplishing bi-directional communication over USB and Ethernet interfaces.  The C# code provides bi-directional communication over all interfaces.

 

Setup Procedure

·     Install the Boca Systems printer driver from the applicable printer driver page of this website.

 

·     Download and save the applicable project:


Visual Studio 2013 (all interfaces) - C# Sample  

[mac driver sample] Released - August 2017


Unzip mac sample code above. A "sample code driver mac" directory will be created and populated with many files, including the entire Xojo project and some test files.


·    We recommend that you test the sample code before making any modifications.  The sample program allows the user to send a string or a file tothe printer and then read the returning data and display it.

 

Please note that, in order to communicate bi-directionally with a driver, you must send an <S1> command immediately prior to each read command.  The printer will typically respond with an X-ON character and any other data that may be sitting in its output buffer.  

 

 

BocaSystems