|
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 and any software while supporting full bi-directional
communication. 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 (W2K and XP), 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, Ethernet, Parallel and
Serial interfaces without the
use of printer drivers. The following projects in RealBasic
(Mac), VB6
and VC can be used in developing bi-directional communication with your
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.
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
RealBasic
(Mac) for accomplishing bi-directional communication over USB and Ethernet interfaces.
The VB6 and VB.net code provides bi-directional communication
over parallel, serial and USB
interfaces. (At the present time, bi-directional communication in
the Windows environment over an
Ethernet interface is limited to applications without printer
drivers.)
Setup
Procedure
· Install
the Boca Systems printer driver from the applicable printer driver page
of
this website.
· Download
and save the applicable project:
[bidi_vb6.zip] Released
- January 2008
Unzip bidi_vb6.zip and a subdirectory
named bidivb6 will be created and populated with many files, including
the
entire VB6 project and some test files.
[bidi_vbnet.zip] Released
- May 2007 (not recommended)
Unzip bidi_vbnet.zip and a subdirectory
named bidinet will be created and
populated with many
files, including the entire VB.net project and some test files.
[mac
driver
sample] Released
- July 2009
Unzip mac sample code above. A "sample code driver mac" directory will
be created and populated with many
files, including the entire RealBasic 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 to
the 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.
If
you need to contact Boca Systems about this project, please direct your
email
to mailto:michael@bocasystems.com.
|