0% found this document useful (0 votes)
68 views117 pages

APD5 Status en Revh

Uploaded by

varoeax
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views117 pages

APD5 Status en Revh

Uploaded by

varoeax
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 117

Advanced Printer Driver Ver.

Status API Manual

Overview
Explains about Status API.

Using Status API


Explains how to establish a development environment,
get ASB statuses, and how to handle the ASB statuses.

Reference for Win32


Describes information of Status API used in Win32 environment.

Reference for .NET


Describes information of Status API used in .NET environment.

M00062208-3EN
Rev.H
Cautions
 No part of this document may be reproduced, stored in a retrieval system, or transmitted in any form or by
any means, electronic, mechanical, photocopying, recording, or otherwise, without the prior written permis-
sion of Seiko Epson Corporation.
 The contents of this document are subject to change without notice. Please contact us for the latest informa-
tion.
 While every precaution has been taken in the preparation of this document, Seiko Epson Corporation
assumes no responsibility for errors or omissions.
 Neither is any liability assumed for damages resulting from the use of the information contained herein.
 Neither Seiko Epson Corporation nor its affiliates shall be liable to the purchaser of this product or third par-
ties for damages, losses, costs, or expenses incurred by the purchaser or third parties as a result of: accident,
misuse, or abuse of this product or unauthorized modifications, repairs, or alterations to this product, or
(excluding the U.S.) failure to strictly comply with Seiko Epson Corporation’s operating and maintenance
instructions.
 Seiko Epson Corporation shall not be liable against any damages or problems arising from the use of any
options or any consumable products other than those designated as Original EPSON Products or EPSON
Approved Products by Seiko Epson Corporation.

Trademarks
EPSON is a registered trademark of Seiko Epson Corporation.
Exceed Your Vision and ESC/POS are registered trademarks or trademarks of Seiko Epson Corporation.
® ® ® ® ® ®
Microsoft , Windows , Visual Studio , Visual Basic , Visual C++ , and Visual C# are either registered trade-
marks or trademarks of Microsoft Corporation in the United States and other countries.
QR Code is registered trademark of DENSO WAVE INCORPORATED in Japan and other countries.
All other trademarks are the property of their respective owners and used for identification purpose only.

®
ESC/POS Command System
EPSON ESC/POS is a proprietary POS printer command system that includes patented or patent-pending com-
mands. ESC/POS is compatible with most EPSON POS printers and displays.
ESC/POS is designed to reduce the processing load on the host computer in POS environments. It comprises a
set of highly functional and efficient commands and also offers the flexibility to easily make future upgrades.

©Seiko Epson Corporation 2012 - 2018. All rights reserved.

2
For Safety

Key to Symbols
The symbols in this manual are identified by their level of importance, as defined below. Read the following
carefully before handling the product.

Provides information that must be observed to avoid damage to your equipment or a malfunction.

Provides important information and useful tips.

Restriction of Use
When this product is used for applications requiring high reliability/safety such as transportation devices
related to aviation, rail, marine, automotive etc.; disaster prevention devices; various safety devices etc; or func-
tional/precision devices etc, you should use this product only after giving consideration to including fail-safes
and redundancies into your design to maintain safety and total system reliability. Because this product was not
intended for use in applications requiring extremely high reliability/safety such as aerospace equipment, main
communication equipment, nuclear power control equipment, or medical equipment related to direct medical
care etc, please make your own judgment on this product’s suitability after a full evaluation.

3
About this Manual

Aim of the Manual


This manual is aimed at development engineer and provides necessary information for developing an applica-
tion using the Status API.

Manual Content
The manual is made up of the following sections:
Chapter 1 Overview

Chapter 2 Using Status API

Chapter 3 Reference for Win32

Chapter 4 Reference for .NET

4
Contents
■ For Safety..................................................................................................................................3
Key to Symbols.................................................................................................................................................................... 3
■ Restriction of Use ....................................................................................................................3
■ About this Manual ..................................................................................................................4
Aim of the Manual ............................................................................................................................................................. 4
Manual Content .................................................................................................................................................................. 4
■ Contents....................................................................................................................................5

Overview...........................................................................................................9
■ Introduction .............................................................................................................................9
Manual organization......................................................................................................................................................... 9
Function...............................................................................................................................................................................10
Glossary ...............................................................................................................................................................................10
■ Development Language ..................................................................................................... 10

Using Status API.............................................................................................11


■ Install and Uninstall............................................................................................................. 11
■ Architecture of the Development Environment ............................................................ 11
■ Types of Status API Functions............................................................................................ 15
■ Programming Flow for ASB Status Acquisition .............................................................. 18
Visual C++ ...........................................................................................................................................................................18
Visual C# / Visual Basic .NET..........................................................................................................................................20
Visual Basic 6.0 ..................................................................................................................................................................21
■ Programming Flow for MICR Control ............................................................................... 22
Visual C++ ...........................................................................................................................................................................22
Visual C# / Visual Basic .NET..........................................................................................................................................23
Visual Basic 6.0 ..................................................................................................................................................................24
■ Status API Errors and Response ........................................................................................ 25
ASB Status...........................................................................................................................................................................25
Status API Execution Error.............................................................................................................................................27
■ How to Use Shared Printers................................................................................................ 29
Constructing the Exclusive Access.............................................................................................................................29
■ Customer Display Status..................................................................................................... 31
Application .........................................................................................................................................................................31
TM Printer Settings ..........................................................................................................................................................31

5
Reference for Win32 ......................................................................................33
■ BiOpenMonPrinter............................................................................................................... 33
■ BiCloseMonPrinter............................................................................................................... 35
■ BiLockPrinter......................................................................................................................... 36
■ BiUnlockPrinter .................................................................................................................... 38
■ BiSetMonInterval ................................................................................................................. 39
■ BiSetMonEtherInterval ....................................................................................................... 40
■ BiDirectIO .............................................................................................................................. 41
■ BiDirectIOEx .......................................................................................................................... 43
■ BiResetPrinter ....................................................................................................................... 46
■ BiForceResetPrinter ............................................................................................................. 47
■ BiCancelError ........................................................................................................................ 48
■ BiGetType .............................................................................................................................. 49
■ BiGetOfflineCode ................................................................................................................. 50
■ BiGetStatus............................................................................................................................ 51
■ BiGetRealStatus.................................................................................................................... 52
■ BiSetStatusBackFunction ................................................................................................... 53
■ BiSetStatusBackFunctionEx ............................................................................................... 54
■ BiSetStatusBackWnd ........................................................................................................... 55
■ BiCancelStatusBack ............................................................................................................. 56
■ BiGetExtendStatus............................................................................................................... 57
■ BiGetInkStatus...................................................................................................................... 58
■ BiSetInkStatusBackFunction.............................................................................................. 59
■ BiSetInkStatusBackFunctionEx ......................................................................................... 60
■ BiSetInkStatusBackWnd ..................................................................................................... 61
■ BiCancelInkStatusBack........................................................................................................ 62
■ BiGetBatteryStatus .............................................................................................................. 63
■ BiSetBatteryStatusBackFunctionEx.................................................................................. 64
■ BiSetBatteryStatusBackWnd.............................................................................................. 65
■ BiCancelBatteryStatusBack................................................................................................ 66
■ BiPowerOff ............................................................................................................................ 67
■ BiAutoPowerOffTime........................................................................................................... 68
■ BiGetCounter ........................................................................................................................ 69
■ BiResetCounter..................................................................................................................... 71
■ BiGetPrnCapability .............................................................................................................. 73
■ BiOpenDrawer ...................................................................................................................... 74

6
■ BiSendDataFile ..................................................................................................................... 76
■ BiDirectSendRead ................................................................................................................ 78
■ BiSetDefaultEchoTime ........................................................................................................ 81
■ BiSetEtherEchoTime ............................................................................................................ 82
■ BiMICRCleaning.................................................................................................................... 83
■ BiMICRGetStatus .................................................................................................................. 84
■ BiMICRLoadCheck................................................................................................................ 85
■ BiMICRReadCheck................................................................................................................ 86
■ BiMICREjectCheck ................................................................................................................ 87
■ BiMICRCancelWaitCheckInsertion .................................................................................... 88
■ BiMICRRetransmissionCheckData .................................................................................... 89
■ BiMICRSelectDataHandling ............................................................................................... 91
■ BiMICRSetReadBackFunction ............................................................................................ 93
■ BiMICRSetReadBackFunctionEX ....................................................................................... 94
■ BiMICRSetReadBackWnd.................................................................................................... 96
■ BiMICRCancelReadBack ...................................................................................................... 97
■ BiSetReadWaitTimeOut ...................................................................................................... 98

Reference for .NET..........................................................................................99


■ Properties .............................................................................................................................. 99
AutoPowerOffTime..........................................................................................................................................................99
InkStatus..............................................................................................................................................................................99
IsValid ...................................................................................................................................................................................99
LastError............................................................................................................................................................................ 100
OfflineCode ..................................................................................................................................................................... 100
Status................................................................................................................................................................................. 100
■ Methods............................................................................................................................... 101
OpenMonPrinter............................................................................................................................................................ 101
CloseMonPrinter............................................................................................................................................................ 101
LockPrinter....................................................................................................................................................................... 101
UnlockPrinter.................................................................................................................................................................. 102
SetMonInterval .............................................................................................................................................................. 102
SetMonEtherInterval.................................................................................................................................................... 102
DirectIOEx ........................................................................................................................................................................ 103
ResetPrinter..................................................................................................................................................................... 104
ForceResetPrinter .......................................................................................................................................................... 104
CancelError ...................................................................................................................................................................... 104
GetType............................................................................................................................................................................. 105
GetRealStatus ................................................................................................................................................................. 105
SetStatusBack ................................................................................................................................................................. 105
CancelStatusBack .......................................................................................................................................................... 106
SetInkStatusBack ........................................................................................................................................................... 106

7
CancelInkStatusBack.................................................................................................................................................... 106
GetBatteryStatus ........................................................................................................................................................... 106
SetBatteryStatusBack................................................................................................................................................... 107
CancelBatteryStatusBack............................................................................................................................................ 107
PowerOff........................................................................................................................................................................... 107
GetCounter...................................................................................................................................................................... 108
ResetCounter .................................................................................................................................................................. 108
GetPrnCapability ........................................................................................................................................................... 109
OpenDrawer.................................................................................................................................................................... 109
SendDataFile................................................................................................................................................................... 109
DirectSendRead............................................................................................................................................................. 110
SetDefaultEchoTime..................................................................................................................................................... 111
SetEtherEchoTime......................................................................................................................................................... 111
MICRCleaning ................................................................................................................................................................. 111
MICRGetStatus ............................................................................................................................................................... 112
MICRLoadCheck............................................................................................................................................................. 112
MICRReadCheck............................................................................................................................................................. 112
MICREjectCheck............................................................................................................................................................. 112
MICRCancelWaitCheckInsertion .............................................................................................................................. 113
MICRRetransmitionCheckData................................................................................................................................. 113
MICRSelectDataHandling........................................................................................................................................... 113
MICRSetReadBack ......................................................................................................................................................... 114
MICRCancelReadBack .................................................................................................................................................. 114
■ Events ................................................................................................................................... 115
StatusCallback ................................................................................................................................................................ 115
StatusCallbackEx ........................................................................................................................................................... 115
BatteryStatusCallbackEx............................................................................................................................................. 115
InkStatusCallback.......................................................................................................................................................... 116
InkStatusCallbackEx ..................................................................................................................................................... 116
MICRReadCallback........................................................................................................................................................ 116
MICRReadCallbackEx ................................................................................................................................................... 117

8
Chapter 1 Overview

Overview
Introduction
Status API is a status monitor API for Epson's TM printers. Advanced functions for monitoring TM printers can
be embedded in applications with print functions.

It cannot be used in the client/terminal service/Citrix XenApp environment of shared printer.

1
Manual organization

Install Manual
Installation/uninstallation of APD, addition/deletion of printer, changing port and silent installation in which
APD is installed automatically are described.

TM Printer Manual
Descriptions of how to use the APD5 and its functions (Application Printer Settings, Paper Feed and Cut Set-
ting, Logo Printing, Barcode Printing, and Font replacing).

Status API Manual


This manual. Descriptions of how to get the status of the TM printer from the user application by using the Sta-
tus API.

Printer Specification
APD5 specifications (printer driver, Status API) are explained. Prepared per different model.

9
Chapter 1 Overview

Function
There are following functions for Status API.
 Confirmation of printer's status (ASB status)
 Confirmation of maintenance counter
 Obtaining the printer information
 Control the drawer

Some functions are not available depending on the TM printer model. For detail, refer to "Printer Spec-
ifications".

1
Glossary

Term Explanation
ASB Status Auto Status Back: This is a function of the TM printer. This is a status automatically sent
from the printer when the printer status changes (opening or closing the cover, out of
paper, print completed, etc.).
Ink ASB Status Ink related information, such as Ink level (not an indicator of ink level, but is a notification
that the ink cartridge needs to be replaced because the ink is nearly empty.), ink cartridge
existence, that is necessary for a print application for an inkjet printer. In the same way as
the ASB Status, this information is automatically sent to the Status API from the TM
printer.
Maintenance Counter TM printer internal counter recording the operating status of the printer, i.e. operating
count of the auto cutter, printer running time, etc.

Development Language

Win32
 Visual Basic 6.0
 Visual C++

.NET
 Visual Basic .NET
 Visual C#

10
Chapter 2 Using Status API

Using Status API


In this chapter, the application development environment architecture using Status API and programming
method are explained.

Install and Uninstall


Status API becomes available after installing the APD5. If uninstalled, it becomes not usable. For detail of instal-
lation and uninstallation, refer to "Install Manual".

Architecture of the Development Environment


The architecture of the application development environment using Status API differs according to the develop-
ment tool.
2
Visual C++
The following are examples of the development environment architecture using C++.

The method when using the Visual Studio 2005 is explained.

1 Start Microsoft Visual C++ and open the project screen.

2 Copy EpsStmApi.h from the folder installed with APD and paste the file into the oper-
ating folder used when developing applications (folder created by the project).

3 Open the Source File. Define EpsStmApi.h using the #include directive.
Definition Methods: #include "EpsStmApi.h"

4 The Visual C++ environment is ready for developing an application using Status API.

11
Chapter 2 Using Status API

Visual Basic .NET


The following is an example for creating the development environment using Visual Basic .NET.

The method when using the Visual Studio 2005 is explained.

1 Start Microsoft Visual Studio 2005 and open the Visual Basic .NET project screen.

2 Right-click on [References] in Solution Explorer, and select


[Add References].
If the [References] item does not appear, click the [Show All Files] icon in Solution Explorer.

3 The “Add References” screen appears. Click the [Browse] tab.

4 Specify followings in [Look in]. 2


32 bit OS: "C:\Programfiles\Epson\Advanced Printer Tool\StatusAPI"
64 bit OS: "C:\Program Files(x86)\Epson\Advanced Printer Tool\StatusAPI"

5 Type the file name “EpsonStatusAPI.dll”, and click [OK].

6 Select [References] - [EpsonStatusAPI] in Solution Explorer, and select “False” for


[Specific Version] in Properties.

7 Using the Imports statement at the very start of the source code, describe as follows.
Imports com.epson.pos.driver

8 The Visual Basic .NET environment is ready for developing an application using Sta-
tus API.

12
Chapter 2 Using Status API

Visual C#
The following is an example for creating the development environment using Visual C#.

The method when using the Visual Studio 2005 is explained.

1 Start Microsoft Visual Studio 2005 and open the Visual C# project screen.

2 Right-click on [References] in Solution Explorer, and select


[Add References].
If the [References] item does not appear, click the [Show All Files] icon in Solution Explorer.

3 The “Add References” screen appears. Click the [Browse] tab.

4 Specify followings in [Look in]. 2


32 bit OS: "C:\Programfiles\Epson\Advanced Printer Tool\StatusAPI"
64 bit OS: "C:\Program Files(x86)\Epson\Advanced Printer Tool\StatusAPI"

5 Type the file name “EpsonStatusAPI.dll”, and click [OK].

6 Select [References] - [EpsonStatusAPI] in Solution Explorer, and select “False” for


[Specific Version] in Properties.

7 Using the using keyword at the very start of the source code, describe as follows.
using com.epson.pos.driver

8 The Visual C# environment is ready for developing an application using Status API.

13
Chapter 2 Using Status API

Visual Basic 6.0


The following are examples of the development environment architecture using Visual Basic.

The method when using the Visual Studio 6.0 is explained.

1 Copy StatusAPI.bas in the folder where the sample program is installed (default is
C:\Program Files\EPSON\EPSON Advanced Printer Driver 5
\Sample\US\Src\VB6\SingleFunction\Program09") and paste it into the operating
folder used when developing applications.

2 Start Microsoft Visual Basic and open the project screen.

3 Select [Add a standard module] from [Project] in the menu bar.

4 The add standard module screen appears. Select the [Existing file] tab and specify 2
"StatusAPI.bas" copied from the sample program in Procedure 1. Click the [Open]
button.
"StatusAPI.bas" is added the project explorer.

5 Select [Reference settings] from [Project] in the menu bar.

6 The reference settings screen appears. Place a check by "Microsoft DAO 3.6 Object
Library" from the [Reference library file] and click the [OK].

7 The Visual Basic 6.0 environment is ready for developing an application using Status
API.

14
Chapter 2 Using Status API

Types of Status API Functions


Status API has the following functions. Refer to "Reference for Win32" on page 33 for details regarding the func-
tions.

The supported functions differ according to the printer model.


Refer to “Printer Specification“ for details regarding each model.

Application Function Description


Starting/Closing BiOpenMonPrinter Calls the specified printer to use Status API.
Status API
BiCloseMonPrinter Closes Status API.
Occupying TM printer BiLockPrinter Occupies TM printer.
While occupied, the printer accepts no API from other
processes.
BiUnlockPrinter Cancels BiLockPrinter.
Acquiring ASB Status BiGetStatus Acquires the ASB status when required by the
application.
2
BiSetStatusBackFunction Provides notification regarding the call of
the callback function notifying the
application when the ASB status of Status
API changes.
BiSetStatusBackFunctionEx Provides notification regarding the call of the callback
function notifying the application when the ASB sta-
tus of Status API changes.
Also acquires the port number.
BiSetStatusBackWnd Generates a button click event when the ASB status of
Status API changes.
BiCancelStatusBack Cancels the auto status notification function. This
function is applicable to BiSetStatusBackFunction,
BiSetStatusBackFunctionEx, and BiSetStatusBackWnd.
Acquiring Extend Status BiGetExtendStatus Acquires the Extend status when required by the
application.
Acquiring Battery Status BiGetBatteryStatus Acquires the printer's current battery status when
required by the application.
BiSetBatteryStatusBack Automatically acquires the printer status (ASB status)
FunctionEx using the callback function when the printer status
changes. Identifies the printer port originating the
callback, in addition to the functions of BiSetStatus-
BackFunction.
BiSetBatteryStatusBackWnd Automatically generates a click event and acquires
the printer status (ASB status) when the printer status
changes.
BiCancelBatteryStatusBack Cancels the automatic status notification request pro-
cess called using the BiSetBatteryStatusBackFunc-
tionEx, or BiSetBatteryStatusBackWnd function.

15
Chapter 2 Using Status API

Application Function Description


Setting the monitoring BiSetMonInterval Configures the time interval for Status API to read
interval of the printer printer status.
BiSetMonEtherInterval Status API configures the read interval of the network
printer status.
Acquiring and resetting BiGetCounter Acquires the maintenance counter value of the
the maintenance printer.
counter
BiResetCounter Resets the maintenance counter of the printer.
Acquiring BiGetType Acquires the TM printer information, such as presence
the printer information of BM sensor and customer display connection.
BiGetPrnCapability Acquires printer information, i.e. firmware, etc.
BiGetOfflineCode Acquires the cause of the printer to go offline.
Drawer control BiOpenDrawer Opens the drawer.
Recovery from BiCancelError After the cause of the error, i.e. paper jam, etc., is
a recoverable error removed, the printer's auto cutter is recovered from
the error status using this function. The status is
recovered to print standby without turning the
2
printer's power off and on.
Set the network printer's BiSetDefaultEchoTime Configures the response confirmation frequency of
timeout. the network printer and the initial time value for a sin-
gle timeout.
BiSetEtherEchoTime Configures the response confirmation frequency of
the network printer and the timeout time for one time
after Status API is available.
Printer reset BiResetPrinter Resets the parallel / USB / ethernet interface printers.
Cannot reset serial interface printers.
BiForceResetPrinter Can reset also the TM printers occupied with BiLock-
Printer.
Power off preprocess BiPowerOff Sets power-off or standby mode.
The following processes are performed:
 Stores the values of the maintenance counter.
 Sets the interface to BUSY.
 Sets the printer to standby mode.
Mobile printer power BiAutoPowerOffTime Acquires and sets the time until the mobile printer is
management turned off. This is not an API for turning off the printer.
Command definition file BiSendDataFile Defines the command definition file created sepa-
rately to the printer. The command is not executed.
BiDirectSendRead Sends the command of the defined command defini-
tion file to the printer and executes the command.
Sends the ESC/POS BiDirectIO Can transmit ESC/POS commands to the printer and
command receive data from the printer.
BiDirectIOEx Can send and receive the ESC/POS commands. Does
not add the ASB suppress command.

16
Chapter 2 Using Status API

Application Function Description


MICR function control BiMICRCleaning Cleans the MICR mechanism.
BiMICRGetStatus Acquires the MICR status when required by the appli-
cation.
BiMICRLoadCheck Loads the check to the check print start position.
BiMICRReadCheck Executes check reading.
BiMICREjectCheck Ejects the check.
BiMICRCancelWaitCheckInsertion Cancels check insertion wait.
BiMICRRetransmitionCheckData Resends the check reading results.
BiMICRSelectDataHandling Selects the check reading operation.
BiMICRSetReadBackFunction Executes reading of checks by BiMICRReadCheck and
registers the address of the callback function.
BiMICRSetReadBackFunctionEx Registers the memory addresses where information
read is set.
BiMICRSetReadBackWnd Executes check reading, registers the handle of a but-
ton which sends the button's click event, and registers
2
the memory address where each type of reading
information is set.
BiMICRCancelReadBack Cancels a reading information notification request
that had been registered.

17
Chapter 2 Using Status API

Programming Flow for ASB Status Acquisition


In this section, the obtaining method of ASB status using Status API is explained using the sequence chart.

The DLL load is not included in the sequence chart.

When Status API (BiOpenMonPrinter) is started, the TM printer automatically sends ASB status as the status
changes to Status API. Following API can be used to obtain ASB status that was sent.

Status API Description


BiGetStatus API that obtains ASB status when user (or application) needs.
BiSetStatusBackFunction API that calls the call back function to send the latest ASB status to the application.
BiSetStatusBackFunctionEx API that calls the call back function to send the latest ASB status to the application. Called
back printer port is also reported.
BiSetStatusBackWnd API that obtains the latest ASB status by registering the memory address storing the ASB
status and application screen button's window handle.
When ASB status changes, the latest ASB status is set in the registered memory address
2
and sends the button click event of registered window handle.
Used when the development environment is Visual Basic 6.0.

Visual C++

(1/2)
Application Status API Printer

BiOpenMonPrinter()

Status monitoring Command


starts
Status

BiLockPrinter()

Occupancy of printer Command

BiSetStatusBackFunctionEx()

Registration of call
back function

18
Chapter 2 Using Status API

(2/2)
Application Status API Printer

BiGetStatus()

Read status

Status

Change of status
Calling the call back
function

Calling the call back


function
Change of status
(Status changes)
2
BiCancelStatusBack()

Release of call back


function

Change of status

BiUnlockPrinter()

Release of printer Command


occupancy

BiCloseMonPrinter()

Status monitoring ends

19
Chapter 2 Using Status API

Visual C# / Visual Basic .NET

When the development environment is Visual C# or Visual Basic .Net, .NET API is used.
Refer to "Reference for .NET" on page 99 for .NET API's detail.

Application Status API Printer

OpenMonPrinter()

Status monitoring starts Command

Status

LockPrinter()

Occupancy of printer Command

StatusCallbackEx()

Add a call back function


to status monitor event
2
SetStatusBack()

Begin the call back


function to status monitor

Status()

Read status

Status

Calling the call Change of status


back function

Change of status
(Status changes)
Calling the call back function

CancelStatusBack()

Stop notifying the call back


function of the status monitor

Change of status

UnlockPrinter()

Release of printer occupancy Command

CloseMonPrinter()

Status monitoring ends

20
Chapter 2 Using Status API

Visual Basic 6.0

Application Status API Printer

BiOpenMonPrinter()

Status monitoring starts Command

Status

BiLockPrinter()

Occupancy of printer Command

BiSetStatusBackWnd()

Button click event of status


monitoring notification starts

BiGetStatus()

Read status
2
Status
Change of status
Send the button click event

Change of status
(Status changes)
Send the button click event

BiCancelStatusBack()

Button click event of status


monitoring notification stops

Change of status

BiUnlockPrinter()

Release of printer occupancy Command

BiCloseMonPrinter()

Status monitoring ends

21
Chapter 2 Using Status API

Programming Flow for MICR Control


The following explains the control method for MICR control using a sequence figure.

The DLL load is not included in the sequence chart.

Visual C++

User Application Status API Printer

BiMICRSetReadBackFunction()

Registers the callback for the


Read Completion Notice

BiMICRSelectDataHandling()

2
Can repeatedly use from
MICRRead to MICREject

loop
BiMICRReadCheck()
Command
The printer goes on standby
for check paper insertion.

Insert MICR paper


Insert the
check paper MICR Data
Callback

Wait until the


callback Notification
is sent

BiMICREjectCheck()
Command
Remove the check paper

BiMICRCancelReaBack()

22
Chapter 2 Using Status API

Visual C# / Visual Basic .NET

When the development environment is Visual C# or Visual Basic .Net, .NET API is used.
Refer to "Reference for .NET" on page 99 for .NET API's detail.

User Application Status API Printer

MICRSetReadBack()

Registers the callback for the


Read Completion Notice

MICRSelectDataHandling()
Can repeatedly use from
MICRRead to MICREject

loop
MICRReadCheck()
Command
The printer goes on standby
for check paper insertion.

Insert the
check paper
Insert MICR paper

MICR Data
2
Callback

Wait until the


callback Notification
is sent

MICREjectCheck()
Command
Remove the check paper

MICRCancelReaBack()

23
Chapter 2 Using Status API

Visual Basic 6.0

User Application Status API Printer

BiMICRSetReadBackWnd()

Button click event of the


Read Completion Notice

BiMICRSelectDataHandling()
Can repeatedly use from
MICRRead to MICREject

loop
BiMICRReadCheck()
Command
The printer goes on standby
for check paper insertion.

Insert MICR paper


Insert the
check paper MICR Data
Button click event

2
BiMICREjectCheck()
Command
Remove the check paper

BiMICRCancelReaBack()

24
Chapter 2 Using Status API

Status API Errors and Response


Status API errors are errors when notifying ASB status and errors generated when calling Status API. The fol-
lowing explains the details of the errors and responses. Refer to the following and respond to the application
errors.

ASB Status
The following are errors returned when ASB status is acquired. The details differ according to the printer
model. Refer to “Printer Specification” for details.

Macro Definition (Constant) Cause Response


ASB_NO_RESPONSE  The power to the printer is not Confirm the status and ports of the printer, i.e.
turned ON. cables, etc.
 The communication cable is not con-
nected.
 The specified printer name/port is
2
different.
ASB_PRINT_SUCCESS Notifies that printing has completed -
successfully. There is nothing else that
is notified.
Notifies that displaying on the
customer display has been completed
successfully.
There is nothing else to be notified.
ASB_UNRECOVER_ERR A print error was generated to the Immediately turn off the power to the printer.
printer. *
ASB_AUTORECOVER_ERR The temperature of the head has If the temperature of the head decreases with
increased. time, the error automatically cancels. *
ASB_OFF_LINE An error causing the printer to go Eliminate the cause of the printer to go
offline was generated. offline.
ASB_PAPER_FEED Paper is being fed. There is no problem if the paper is being fed.
ASB_PANEL_SWITCH The printer's panel switch is being  There is no problem if a switch on the
pressed. printer's panel is being pressed.
 By setting the TM printer's switch or button
to not effective (Ex. FEED button), user can
use the feed button control as a trigger
which can conduct event generation/han-
dling from the application side.
ASB_MECHANICAL_ERR A mechanical error was generated, i.e. Eliminate the cause of the error and restart
home position detection error, etc. the printer or send an error recovery com-
mand (BiCancelError). *
ASB_AUTOCUTTER_ERR An auto cutter error was generated. Eliminate the cause of the error and restart
the printer or send an error recovery com-
mand (BiCancelError). *
ASB_DRAWER_KICK The drawer is open. There is no problem if the drawer has been
left open intentionally.
ASB_RECEIPT_END No paper. Place paper in the printer.

25
Chapter 2 Using Status API

Macro Definition (Constant) Cause Response


ASB_RECEIPT_NEAR_END There is only a limited amount of paper Place paper in the printer.
remaining.
ASB_COVER_OPEN The cover is open. Close the printer's cover.
ASB_WAIT_ON_LINE Waiting for getting back into online. -
ASB_SLIP_INSERT_WAIT The printer is waiting for slip paper to Place slip paper in the printer.
be inserted.
ASB_SLIP_REMOVE_WAIT The printer is waiting for slip paper to Remove the slip paper from the printer.
be removed.
ASB_SLIP_TOF No paper is detected. This is not an -
error but indicating the printer status.
ASB_SLIP_BOF No paper is detected. This is not an -
error but indicating the printer status.
ASB_SLIP_SELECTED This indicates whether the slip has -
been selected.
ASB_PRINT_SLIP The printer is waiting for the slip to be -
inserted or the slip is being copied/dis-
2
charged.
ASB_VALIDATION_SELECTED This indicates whether the validation -
has been selected.
ASB_PRINT_VALIDATION The printer is waiting for the slip to be -
inserted or the validation is being cop-
ied/discharged.
ASB_EJECT_DETECT_NO_PAPER No paper is detected by the ejection -
sensor. This is not an error but indicat-
ing the printer status.
ASB_VALIDATION_TOF No paper is detected. This is not an -
error but indicating the printer status.
ASB_VALIDATION_NO_PAPER No paper is detected by the validation -
detector. This is not an error but indi-
cating the printer status.

* Refer to the detailed operating manuals of the various printers.

The macro definition is defined using the EpsStmApi.h or Module1.bas file when the development
environment is constructed.

26
Chapter 2 Using Status API

Status API Execution Error


The following are errors generated when Status API functions are called. The contents differ according to Status
API function. Refer to "Reference for Win32" on page 33 for details.

Macro Definition
Cause Response
(Constant)
ERR_TYPE The parameters of nType differ. Specify the correct value.
ERR_OPENED The specified printer is already opened. As the printer is already opened, use the handle
value or specify a different printer.
ERR_NO_PRINTER The specified printer driver does not exist. Confirm the name of the printer driver.
ERR_NO_TARGET The specified printer cannot be found. Connect to the correct printer.
An unspecified printer is connected.
ERR_NO_MEMORY There is not enough memory. Add available memory.
ERR_HANDLE The handle value specified by the printer is Confirm the handle value.
incorrect. 2
ERR_TIMEOUT This is a timeout error. If the error is continuously generated, confirm
whether the printer is properly connected.
ERR_ACCESS Access cannot be per formed on the Confirm the printer. (Printer power, cable con-
printer. nection, etc.)
(The power to the printer is not turned on
or the cable is not properly connected,
etc.)
ERR_PARAM This is a parameter error. Review the syntax as the specified parameter is
incorrect.
ERR_NOT_SUPPORT This is an unsupported model. Unsupported models cannot be used.
ERR_EXIST The specified data already exists. Delete the already existing data.
Example:
When this error occurs during executing BiSet-
StatusBackXXX, retry it after executing BiCancel-
StatusBack.
ERR_EXEC_FUNCTION This function is unavailable as Status API is Close the Status API used by other applications.
used by other applications.
ERR_PH_NOT_EXIST The PortHandler is not running, or a com- Verify the connection between them, then
munication error between the client of restart the computer.
PortHandler and the server.
ERR_SPL_NOT_EXIST The spooler service is not operating. Confirm if the Print Spooler service has started.
(Control Panel - Management Tools - Service)
ERR_RESET This function is unavailable as the printer is Recall after waiting a moment.
being reset.
ERR_LOCKED The printer is locked. Wait until the printer becomes unlocked, or exe-
cute BiUnlockPrinter in the program that is lock-
ing the printer.

27
Chapter 2 Using Status API

Macro Definition
Cause Response
(Constant)
ERR_NO_PAPER No paper is in the printer. Set paper in the printer and call this API again.
ERR_BUFFER_OVER_FLOW Lack of buffer capacity. Check the buffer capacity to be ensured.
ERR_EXEC_MICR Cannot call as the MICR is reading Execute after MICR processing is complete.

The macro definition is defined using the EPSStmApi.h or StatusAPI.bas file when the development
environment is constructed.

28
Chapter 2 Using Status API

How to Use Shared Printers


When using shared printers, note the followings when developing an application.
 A whole process of accessing to the device shall be performed exclusively.
 Handling of BiLockPrinter error is necessary.
 Set a time of exclusive access to the printer as short as possible.

When you set a firewall, add the port number 2291 to [Exception].

Constructing the Exclusive Access

Exclusive control of a process sequence


Construct an application putting each of process sequences between BiLockPrinter and BiUnlockPrinter.

Thread
2
BiLockPrinter

Process sequence

BiUnlockPrinter

When you use only one API in your application, the exclusive access is not necessary.

Handling of BiLockPrinter error


When the printer is already accessed from another process, the BiLockPrinter returns an error
(ERR_LOCKED). Construct the application so that the error is handled and the BiLockPrinter is executed
again after handling the error.

Shortening exclusive access time to the printer


While the printer is accessed exclusively, other processes cannot execute exclusive API and printing is disabled.
Therefore, set the exclusive access time as short as possible to improve the system performance.

29
Chapter 2 Using Status API

Program example
DWORD dwReadcounter = 0;
int nRet = BiLockPrinter(1, 1000);
if (nRet == SUCCESS) {
//Right to execute API exclusively is given during the period from the printer lock to unlock.
//Acquisition of the maintenance counter value
BiGetCounter(1, 20, &dwReadcounter);
BiGetCounter(1, 21, &dwReadcounter);
BiGetCounter(1, 50, &dwReadcounter);
//Printer unlock
BiUnlockPrinter(1);
} else {
//Error handling when printer lock fails

}

30
Chapter 2 Using Status API

Customer Display Status


When the customer display is connected to a TM printer, completion of display on the customer display can be
acquired.

When the customer display is connected alone, completion of display on the customer display cannot
be acquired.

Application
Acquires the ASB status of the printer that is connected to the customer display.
Acquires the ASB status of the printer using API to acquire the ASB status (BiGetStatus).
When displaying on the customer display is completed, ASB_PRINT_SUCCESS is returned.

TM Printer Settings
2
Set the TM printer with the "Command execution during offline" function as follows:

For the TM printer without the "Command execution during offline" function, the settings are not
required.

1 Select [Start] - [Printers and Devices settings].


Printers and devices registered in the computer are displayed.

2 Right-click the TM printer, then select [Printing Preferences].


[Printing Preferences] window appears.

3 Select [Advanced Settings] tab, then click [Advanced Setting].


APD5 Utility is launched.

31
Chapter 2 Using Status API

4 Click [Printing Control].

5 Set [Command execution during offline] to [Enable].

2
The screen display varies depending on the TM printer model.

6 Click [Set].
Settings are reflected to the printer.

32
Chapter 3 Reference for Win32

Reference for Win32


This chapter explains Status API and the syntax used in Win32 environment.

The data type is described in C++.

Refer to "Printer Specifications" for API, ASB status, ink status, offline element, maintenance counter
that can be used by each printer for detail.

BiOpenMonPrinter
Makes Status API available for the printer and returns the handle.
You can open one printer from multiple processes at the same time.
When you open the opened printer from the same process again, a new different handle will return. In such a
case, both handles are valid.

Syntax
int BiOpenMonPrinter (int nType, LPSTR pName)

Parameter
3
nType: Specifies the pName type.
Macro Definition
Value Description
(Constant)
TYPE_PORT 1 Specify the port name in pName.
TYPE_PRINTER 2 Specify the printer name in pName.

pName: If 1 is specified in nType, specify the port name (example: "ESDPRT001").


If 2 is specified, specify the printer name (example: "EPSON TM-T88V Receipt").
Example)
 Specifying a printer with the port name (ESDPRT001)
nHandle = BiOpenMonPrinter(1,"ESDPRT001");
 Specifying a printer with the printer name (EPSON TM-T88V Receipt)
nHandle = BiOpenMonPrinter(2, "EPSON TM-T88V Receipt");
 Specifying the shared printer(EPSON TM-T88V Receipt) with the host name "SERVER"
nHandle = BiOpenMonPrinter( 2, \\SERVER\”EPSON TM-T88V Receipt”);

33
Chapter 3 Reference for Win32

Return value
Returns the variable defined in INT type. If Status API is successfully used, the handle identifying the printer is
returned. The handle is returned even if the printer is offline. The following Status API execution errors (value)
are returned.
Macro Definition
Value Description
(Constant)
ERR_TYPE -10 Parameter error of nType
ERR_OPENED -20 The specified printer is already opened.
ERR_NO_PRINTER -30 The specified printer driver does not exist
ERR_NO_TARGET -40 Printer unavailable
ERR_NO_MEMORY -50 Not enough memory
ERR_TIMEOUT -70 Timeout error
ERR_ACCESS -80 Access cannot be performed on the printer
ERR_PARAM -90 Parameter error
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client of
PortHandler and the server.
ERR_SPL_NOT_EXIST -350 The spooler service is not operating.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.
3
Comment
Call this function before using other Status API functions. The handle of the return value is used as the Param-
eter by other Status API functions.
The maximum number of printers that can be started at one time is 32.
The following operations are executed according to the printer status when this function is called.
Printer Status Operation
Online Returns the handle.
Offline Returns the handle. However, switch to online as the printer cannot print offline.
Cable Removed/Power Off Returns "ERR_ACCESS".

34
Chapter 3 Reference for Win32

BiCloseMonPrinter
Cancels the status monitoring printer.
When a BiOpenMonPrinter function is called, always cancel the status monitoring printer using the
BiCloseMonPrinter function.

Syntax
int BiCloseMonPrinter (int nHandle)

Parameter
nHandle: Specifies the handle.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client of
PortHandler and the server.
3
For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

35
Chapter 3 Reference for Win32

BiLockPrinter
Locks the printer.

 This API is used for a shared printer.


 When using a local printer, this API is used to control multiple processes.

Syntax
int BiLockPrinter (int nHandle, DWORD timeout)

Parameter
nHandle: Specifies the handle.
timeout: Specifies the timeout time in ms (milliseconds). Specify it with a positive value.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_EXEC_FUNCTION
ERR_EXEC_MICR
-310
-320
This function is unavailable as Status API is used by other applications.
Cannot call as the MICR is reading
3
ERR_EXEC_SCAN -330 Cannot call as the scanner is scanning
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client
of PortHandler and the server.
ERR_RESET -400 Cannot call as the printer is restarting
ERR_LOCKED -1000 The printer is locked.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

36
Chapter 3 Reference for Win32

Comment
This API allows you to access the TM printer exclusively. The BiUnlockPrinter API is provided for canceling the
exclusive access. While the TM printer is exclusively accessed, the printer does not accept any other API
requests of direct access to the printer. The printer will return ERR_LOCKED to those other API requests.
The exclusive access right to the TM printer is given to a process. Therefore, the exclusive API access is available
from other threads in the same process that is locking the printer.
Executing of API in the same process can be repeated. In this case, the printer is locked with multiple accesses.
To unlock the printer, execute BiUnlockPrinter the number of times the API has been executed.
When executing exclusive access from a client to a shared printer or to a local printer via Ethernet, the access
status is interrupted if the connection is lost, and restored upon recovery of the connection.
However, while the exclusive access status is being interrupted, another process can lock the TM printer for
exclusive access. Once the printer is locked by another process, the printer returns ERR_LOCKED to API of the
previous process. When another process is finished unlocking the printer, the exclusive access status of the pre-
vious process is restored.
Possible causes of the connection failure are as follows.
[Failure during exclusive access to a printer connected via Ethernet]
 The printer is turned Off, or the Ethernet connection between the computer and the printer is disconnected.
 The computer has entered Standby or Hibernate mode.
[Failure during exclusive access to a shared printer from a client]
 The connection between the client and the server is disconnected.
3
 The client computer has entered Standby or Hibernate mode.

37
Chapter 3 Reference for Win32

BiUnlockPrinter
Unlocks the lock of the printer.

 This API is used for a shared printer.


 When using a local printer, this API is used to control multiple processes.

Syntax
int BiUnlockPrinter (int nHandle)

Parameter
nHandle: Specifies the handle.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_EXEC_FUNCTION -310 This function is unavailable as Status API is used by other applications.
ERR_EXEC_MICR
ERR_EXEC_SCAN
-320
-330
Cannot call as the MICR is reading
Cannot call as the scanner is scanning
3
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client of
PortHandler and the server.
ERR_RESET -400 Cannot call as the printer is restarting
ERR_LOCKED -1000 The printer is locked.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
This API unlocks the printer locked by “BiLockPrinter”. After the lock is canceled, the printer can accept the
API from other processes.
If you execute this API when the printer is not locked, "ERR_LOCKED" will be returned to Return value.

38
Chapter 3 Reference for Win32

BiSetMonInterval
Configures the time interval for Status API to read printer status.

For interfaces supporting Ethernet, this is done by BiSetMonEtherInterval. See "BiSetMonEtherInter-


val" on page 40.

Syntax
int BiSetMonInterval (int nHandle, WORD wUnused, WORD wInterval)

Parameter
nHandle: Specifies the handle.
wUnused: Not used.
wInterval: Specifies the interval to monitor the status of Status API in milliseconds.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS
ERR_HANDLE
0
-60
Success
Specified handle is invalid 3
ERR_PARAM -90 Parameter error
ERR_EXEC_FUNCTION -310 This function is unavailable as Status API is used by other applications.
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client of
PortHandler and the server.
ERR_LOCKED -1000 The printer is locked.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
The default value is 100 milliseconds if the interval to monitor the status of Status API is not specified by this
API.

 When using the serial interface with long interval, the serial reception buffer gets over-flowed caus-
ing the inability to obtain correct ASB status.
 Before execute this API, execute BiUnlockPrinter.

39
Chapter 3 Reference for Win32

BiSetMonEtherInterval
Status API configures the read interval of the network printer status.

If the interface of your printer is a parallel I/F, serial I/F or USB I/F, this is done by BiSetMonInterval. See
"BiSetMonInterval" on page 39.

Syntax
int BiSetMonEtherInterval (int nHandle, WORD wEtherInterval)

Parameter
nHandle: Specifies the handle.
wEtherInterval: Specifies the interval to monitor the status of Status API (1 to 65) in second.
Even if the value more than 65 seconds is configured, 65 seconds will be actually config-
ured.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS
ERR_HANDLE
0
-60
Success
Specified handle is invalid
3
ERR_ACCESS -80 Access cannot be performed on the printer
ERR_PARAM -90 Parameter error
ERR_NOT_SUPPORT -100 Not supported
ERR_EXEC_FUNCTION -310 This function is unavailable as Status API is used by other applications.
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client of
PortHandler and the server.
ERR_LOCKED -1000 The printer is locked.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
The default value is 3 seconds if the interval to monitor the status of Status API is not specified by this API.

Before execute this API, execute BiUnlockPrinter.

40
Chapter 3 Reference for Win32

BiDirectIO
Sends special commands (ESC/POS command) to the printer. Can also acquire command execution results
from the printer. It is recommended that BiDirectIOEx is used to acquire execution results.

Refer to the following URL for details of the ESC/POS command.


https://reference.epson-biz.com/modules/ref_escpos/index.php?content_id=2

Syntax
int BiDirectIO (int nHandle, BYTE writeLen, LPBYTE writeCmd, LPBYTE readLen,
LPBYTE readBuff, DWORD timeout, BOOL nullTerminate)

Parameter
nHandle: Specifies the handle.
writeLen: Specifies the data length to write to the printer. Does not write to the printer when "0".
writeCmd: Specifies the data (ESC/POS command) to write to the printer.
readLen: Specifies the data length read from the printer.
Specify when the command execution results are required from the printer.
Specify as "0" when not required.
readBuff: Specifies the buffer saving the data read from the printer. 3
timeout: Specifies the timeout time in ms (milliseconds).
nullTerminate: In the case of "True", reading is complete when NULL is received from the printer. At this
time, specify the readBuff size to readLen.
In the case of "FALSE ", the length of data specified in readLen is read or data is read from the
printer until a timeout error is generated.

Ensure that the size of readBuff is the same length specified in readLen or longer.

41
Chapter 3 Reference for Win32

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_TIMEOUT -70 Timeout error
ERR_ACCESS -80 Access cannot be performed on the printer
ERR_PARAM -90 Parameter error
ERR_BUFFER_OVER_FLOW -140 Lack of buffer capacity.
ERR_EXEC_FUNCTION -310 This function is unavailable as Status API is used by other applications.
ERR_EXEC_MICR -320 Cannot call as the MICR is reading
ERR_EXEC_SCAN -330 Cannot call as the scanner is scanning
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client
of PortHandler and the server.
ERR_RESET -400 Cannot call as the printer is restarting
ERR_LOCKED -1000 The printer is locked.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
3
Confirm proper execution of the function by confirming the return value of return value or proper command
execution by confirming printer operation. If execution results are acquired from the printer (specify readLen),
confirm the execution results.
The following operations are executed according to the printer status when this function is called.
Printer Status Operation
Online Returns "SUCCESS" to the return value. Executes the command.
Offline  Returns “SUCCESS” when communication with the printer completed success-
fully within the time specified with the Timeout.
 Returns “ERR_TIMEOUT” when failed to communicate with the printer within the
time specified with the Timeout.
Cable Removed/Power Off Returns "ERR_ACCESS" to the return value.
Printing Returns "ERR_LOCKED" to the return value.

42
Chapter 3 Reference for Win32

BiDirectIOEx
Sends special commands (ESC/POS command) to the printer. Can also acquire command execution results
from the printer. The ASB suppress command can be added for differences with BiDirectIO. When the ASB
suppress command is added, separate data (ASB status, etc.) is not sent from the printer until this function is
complete, therefore, this is recommended when receiving execution results from the printer.

 When considering expandability and versatility, it is recommended to use BiDirectIOEx rather than
using the BiDirectIO function.
 Refer to the following URL for details of the ESC/POS command.
https://reference.epson-biz.com/modules/ref_escpos/index.php?content_id=2

Syntax
int BiDirectIOEx (int nHandle, DWORD writeLen, LPBYTE writeCmd,
LPDWORD readLen, LPBYTE readBuff, DWORD timeout,
BOOL nullTerminate, BYTE option)

Parameter
nHandle: Specifies the handle.
writeLen:
writeCmd:
Specifies the data length to write to the printer. Does not write to the printer when "0".
Specifies the data (ESC/POS command) to write to the printer. 3
readLen: Specifies the data length read from the printer.
Specify when the command execution results are required from the printer.
Specify as "0" when not required.
readBuff: Specifies the buffer saving the data read from the printer.
timeout: Specifies the timeout time in ms (milliseconds).
nullTerminate: In the case of "True", reading is complete when NULL is received from the printer. At this
time, specify the readBuff size to readLen.
In the case of "FALSE", the length of data specified in readLen is read or data is read from the
printer until a timeout error is generated.
option: Controls the ASB suppression command.
Value Description
0 Send an ASB suppression command before writing data and enable ASB after reading the
data.
1 Does not send the ASB suppression command or ASB enable command.

 Although the maximum data length that can be specified for readLen/writeLen is 2GB, specify the
required minimum data length.
 Ensure that the size of readBuff is the same length specified in readLen or longer.

43
Chapter 3 Reference for Win32

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_NO_MEMORY -50 Not enough memory
ERR_HANDLE -60 Specified handle is invalid
ERR_TIMEOUT -70 Timeout error
ERR_ACCESS -80 Access cannot be performed on the printer
ERR_PARAM -90 Parameter error
ERR_BUFFER_OVER_FLOW -140 Lack of buffer capacity.
ERR_EXEC_FUNCTION -310 This function is unavailable as Status API is used by other
applications.
ERR_EXEC_MICR -320 Cannot call as the MICR is reading
ERR_EXEC_SCAN -330 Cannot call as the scanner is scanning
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client
of PortHandler and the server.
ERR_RESET -400 Cannot call as the printer is restarting
ERR_LOCKED -1000 The printer is locked.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27. 3
Comment
Confirm proper execution of the function by confirming the return value of return value or proper command
execution by confirming printer operation. If execution results are acquired from the printer (specify readLen),
confirm the execution results.
The following operations are executed according to the printer status when this function is called.
Printer Status Operation
Online Returns "SUCCESS" to the return value. Executes the command.
Offline  Returns “SUCCESS” when communication with the printer completed success-
fully within the time specified with the Timeout.
 Returns “ERR_TIMEOUT” when failed to communicate with the printer within
the time specified with the Timeout.
Cable Removed/Power Off Returns "ERR_ACCESS" to the return value.
Printing Returns "ERR_LOCKED" to the return value.

44
Chapter 3 Reference for Win32

Caution
 Do not send invalid commands of ASB status transmissions using this function while monitoring the status
of the printer. Subsequent status cannot be acquired.
 The ASB (automatic status notification) suppression command ensures that unintended data is not received
when sending commands requesting a response from the printer.
If you do not use the ASB suppression, ensure that the programming considers the reception of unintended
data.
 Specifying the receiving buffer processes the data received from the printer using this function or processes
the data using the same process as the monitoring sled (BiGetStatus function, etc.). Refer to the following.
Transmission Receiving Buffer Operation of the
Receiving Buffer
Command Specified Monitoring Sled
Acquiring Yes Saves the ASB status to the  Does not callback
status command receiving buffer  Does not renew the
status
No -  Does not callback
 Does not renew the
 status
Presenter Yes Saves the presenter response to Does not callback
Command the receiving buffer

Command with
No
Yes
-
Enters the printer response into
Calls back the presenter
Does not effect the monitor-
3
responses from other the receiving buffer ing sled
printers No - Abnormal callbacks may be
generated
Command without Yes Generates timeout error Does not effect the monitor-
responses from other ing sled
printers No - Does not effect the monitor-
ing sled

45
Chapter 3 Reference for Win32

BiResetPrinter
Resets status monitoring printers.

 Cancels print jobs when this is called while printing.


 The TM printer with the serial interface cannot be reset.

Syntax
int BiResetPrinter (int nHandle)

Parameter
nHandle: Specifies the handle.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_NOT_SUPPORT -100 Not supported
ERR_EXEC_FUNCTION
ERR_PH_NOT_EXIST
-310
-340
Cannot call as another Status API is in use
The PortHandler is not running or a communication error between the client of
3
PortHandler and the server.
ERR_RESET -400 Cannot call as the printer is restarting
ERR_LOCKED -1000 The printer is locked.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
Confirm proper execution of the function by confirming the return value of return value or by resetting the
printer and confirming that the printer is online (confirming the ASB status).

After this function is executed, the printer cannot receive a print command for 15 seconds. If print is
executed during this time, the job is sent to the spooler and the print processes is executed after the
passage of the aforementioned time.

The following operations are executed according to the printer status when this function is called.
Printer Status Operation
Online Returns "SUCCESS" to the return value and resets.
Offline Returns "SUCCESS" to the return value and resets.
Cable Removed/Power Off Returns "ASB_NO_RESPONSE" to ASB status and does not reset.
Printing Cancels the print job and resets.

46
Chapter 3 Reference for Win32

BiForceResetPrinter
Forces to reset the TM printer whose status is being monitored.
The TM printer can be reset even in multi-thread/process/user environments.
The TM printer can be reset even if BiLockPrinter is accessed by a different program.
If the connection to a network printer is lost and then re-established, some time will be required before printing
is possible again. Use of this API allows that time to be shortened.

 This API will force the printer to reset even if printing is in progress, and the data being printed will
be deleted.
 The TM printer with the serial interface cannot be reset.

Syntax
int BiForceResetPrinter (int nHandle)

Parameter
nHandle: Specifies the handle.

Return value
Macro Definition
(Constant)
Value Description 3
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_ACCESS -80 Access cannot be performed on the printer
ERR_NOT_SUPPORT -100 Not supported
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client of
PortHandler and the server.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

47
Chapter 3 Reference for Win32

BiCancelError
If a printer recoverable error is generated, execute this function after removing the error cause, and the TM
printer recovers from the error.

If a printer recoverable error is generated while transmitting data, recovery may not be possible with
this function. In this case, use BiResetPrinter after resolving the error cause and recover from the error.

Syntax
int BiCancelError (int nHandle)

Parameter
nHandle: Specifies the handle.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_ACCESS
ERR_NOT_SUPPORT
-80
-100
Access cannot be performed on the printer
Not supported
3
ERR_EXEC_FUNCTION -310 This function is unavailable as Status API is used by other
applications.
ERR_EXEC_MICR -320 Cannot call as the MICR is reading
ERR_EXEC_SCAN -330 Cannot call as the scanner is scanning
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client
of PortHandler and the server.
ERR_RESET -400 Cannot call as the printer is restarting
ERR_LOCKED -1000 The printer is locked.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
Use BiCancelError as follows.
Error Response
Cover open error Call this function after closing the cover.
Auto cutter error Call this function after removing any paper around the cutter and closing the cover.

48
Chapter 3 Reference for Win32

BiGetType
Acquires the type ID of the printer.

For information on the type ID that can be acquired, ask your dealer.

Syntax
int BiGetType (int nHandle, LPBYTE typeID, LPBYTE font, LPBYTE exrom,
LPBYTE special)
Parameter
nHandle: Specifies the handle.
typeID: A type ID of the printer will be set.
font: Device font will be set.
exrom: This is not applicable.
special: A special ID of the printer will be set.

Return value
Macro Definition
(Constant)
Value Description 3
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_TIMEOUT -70 Timeout error
ERR_ACCESS -80 Access cannot be performed on the printer
ERR_PARAM -90 Parameter error
ERR_NOT_SUPPORT -100 Not supported
ERR_EXEC_FUNCTION -310 This function is unavailable as Status API is used by other applications.
ERR_EXEC_MICR -320 Cannot call as the MICR is reading
ERR_EXEC_SCAN -330 Cannot call as the scanner is scanning
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client of
PortHandler and the server.
ERR_RESET -400 Cannot call as the printer is restarting
ERR_LOCKED -1000 The printer is locked.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
Some information may not be obtained depending on models. In the case, 0 is returned to typeID.

49
Chapter 3 Reference for Win32

BiGetOfflineCode
Acquires the cause of the printer to go offline.

 While the Ethernet is connected, acquiring the offline cause is not supported.
 If this function is called while the printer is online, the offline cause cannot be acquired. In addition,
the cause cannot be acquired when the printer power is OFF or cables have been unplugged.
 Call this function after 500ms have passed after calling BiResetPrinter (printer reset).

Syntax
int BiGetOfflineCode (int nHandle, LPBYTE offlinecode)

Parameter
nHandle: Specifies the handle.
offlinecode: Returns the offline cause as a 5 byte value.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS
ERR_HANDLE
0
-60
Success
Specified handle is invalid
3
ERR_PARAM -90 Parameter error
ERR_NOT_SUPPORT -100 Not supported
ERR_EXEC_FUNCTION -310 This function is unavailable as Status API is used by other applications.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
Refer to “Printer Specification” regarding the causes for the printer to go offline.
The following operations are executed according to the printer status when this function is called.
Printer Status Operation
Online Returns "SUCCESS" to the return value and acquires the online value.
Offline Returns "SUCCESS" to the return value and acquires the offline cause.
Cable Removed/Power Off Returns "SUCCESS" to the return value but cannot acquire the offline cause.

50
Chapter 3 Reference for Win32

BiGetStatus
Acquires the current printer status (ASB status).

Syntax
int BiGetStatus (int nHandle, LPDWORD lpStatus)

Parameter
nHandle: Specifies the handle.
lpStatus: Returns the ASB status saved to Status API.
The ASB status is a 4 byte configuration.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_PARAM -90 Parameter error
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use
3
For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
Refer to “Printer Specification” regarding the ASB status that can be acquired by each printer.

51
Chapter 3 Reference for Win32

BiGetRealStatus
Acquires the current printer status (ASB status).

Syntax
int BiGetRealStatus (int nHandle, LPDWORD lpStatus)

Parameter
nHandle: Specifies the handle.
lpStatus: Returns the ASB status saved to Status API.
The ASB status is a 4 byte configuration.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_ACCESS -80 Access cannot be performed on the printer
ERR_PARAM
ERR_EXEC_FUNCTION
-90
-310
Parameter error
Cannot call as another Status API is in use
3
ERR_EXEC_MICR -320 Cannot call as the MICR is reading
ERR_EXEC_SCAN -330 Cannot call as the scanner is scanning
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client
of PortHandler and the server.
ERR_RESET -400 Cannot call as the printer is restarting
ERR_LOCKED -1000 The printer is locked.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
This function sends the command to acquire the ASB status to the printer and receives the acquired status after
the function is called. That is why, even when printing has been completed, ASB_PRINTSUCCESS is not
acquired. Also, when the power is turned off, ASB_NO_RESPONSE is not acquired because ERR_ACCESS is
returned.
Refer to “Printer Specification” regarding the ASB status that can be acquired by each printer.

52
Chapter 3 Reference for Win32

BiSetStatusBackFunction
Automatically acquires the printer status (ASB status) using the callback function when the printer status
changes.

This is unavailable when the development environment is VB 6.0.

Syntax
int BiSetStatusBackFunction (int nHandle, int (CALLBACK EXPORT *pStatusCB)
(DWORD dwStatus))

Parameter
nHandle: Specifies the handle.
*pStatusCB: Specifies the definition address of the callback function.

Parameter of call back function


dwStatus: Returns the ASB status saved to Status API.
The ASB status is a 4 byte configuration.

Return value
3
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_PARAM -90 Parameter error
ERR_EXIST -210 The specified data already exists.
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
Call this function to set the printer status to dwStatus and call the callback function. When the printer status
changes, new information is automatically set to dwStatus and calls the callback function. Cancel this function
using BiCancelStatusBack.
Refer to “Printer Specification” regarding the ASB status that can be acquired by each printer.

Status API cannot be used within the registered callback function.

53
Chapter 3 Reference for Win32

BiSetStatusBackFunctionEx
Automatically acquires the printer status (ASB status) using the callback function when the printer status
changes.
Identifies the printer port originating the callback, in addition to the functions of BiSetStatusBackFunction.

This is unavailable when the development environment is VB 6.0.

Syntax
int BiSetStatusBackFunctionEx (int nHandle, int (CALLBACK EXPORT *pStatusCB)
(DWORD dwStatus, LPSTR lpcPortName))

Parameter
nHandle: Specifies the handle.
*pStatusCB: Specifies the definition address of the callback function.

Parameter of call back function


dwStatus: Returns the ASB status saved to Status API. The ASB status is a 4 byte configuration.
lpcPortName: Returns the printer port name originating the callback. 3
Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_PARAM -90 Parameter error
ERR_EXIST -210 The specified data already exists.
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
Call this function to set the printer status to dwStatus and call the callback function. When the printer status
changes, new information is automatically set to dwStatus and calls the callback function. Cancel this function
using BiCancelStatusBack.
Refer to “Printer Specification” regarding the ASB status that can be acquired by each printer.

Status API cannot be used within the registered callback function.

54
Chapter 3 Reference for Win32

BiSetStatusBackWnd
Automatically generates a click event and acquires the printer status (ASB status) when the printer status
changes.

Syntax
int BiSetStatusBackWnd (int nHandle, long hWnd, LPDWORD lpStatus)

Parameter
nHandle: Specifies the handle.
hWnd: Specifies the window handle of the button generating the click event.
lpStatus: Returns the ASB status saved to Status API.
The ASB status is a 4 byte configuration.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE
ERR_PARAM
-60
-90
Specified handle is invalid
Parameter error
3
ERR_EXIST -210 The specified data already exists.
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
Refer to “Printer Specification” regarding the ASB status that can be acquired by each printer.
Cancel this function using BiCancelStatusBack.

Status API cannot be used from the specified window handle.

55
Chapter 3 Reference for Win32

BiCancelStatusBack
Cancels the automatic status notification request process called using the BiSetStatusBackFunction, BiSetStatus-
BackFunctionEx, or BiSetStatusBackWnd function.

Syntax
int BiCancelStatusBack (int nHandle)

Parameter
nHandle: Specifies the handle.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use

 Returns "SUCCESS" even when executed when the automatic status notification request process is
not registered.
 For information on remedies for the Status API execution errors, refer to "Status API Execution
3
Error" on page 27.

56
Chapter 3 Reference for Win32

BiGetExtendStatus
Acquires the current printer extend status.

Syntax
int BiGetExtendStatus (int nHandle, LPWORD lpStatus)

Parameter
nHandle: Specifies the handle.
lpStatus: Returns the extend status saved to Status API.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_PARAM -90 Parameter error
ERR_NOT_SUPPORT -100 Not supported
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use
3
For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
Refer to "Printer Specification for TM-xxxx" regarding the extend status that can be acquired by each printer.

57
Chapter 3 Reference for Win32

BiGetInkStatus
Acquires the current ink status.

Syntax
int BiGetInkStatus (int nHandle, LPWORD status)

Parameter
nHandle: Specifies the handle.
status: The current ink status is returned. The ink status is a 2 byte configuration.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_PARAM -90 Parameter error
ERR_NOT_SUPPORT -100 Not supported
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use
3
For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
Refer to “Printer Specification” regarding the ink status that can be acquired by each printer.

58
Chapter 3 Reference for Win32

BiSetInkStatusBackFunction
Automatically acquires the ink status using the callback function when the ink status changes.

This is unavailable when the development environment is VB 6.0.

Syntax
int BiSetInkStatusBackFunction (int nHandle, int (CALLBACK EXPORT *pStatusCB)
(WORD wStatus))

Parameter
nHandle: Specifies the handle.
*pStatusCB: Specifies the definition address of the callback function.

Parameter of call back function


wStatus: Automatically returns the ink status. The ink status is a 2 byte configuration.

Return value
Macro Definition
(Constant)
Value Description
3
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_PARAM -90 Parameter error
ERR_NOT_SUPPORT -100 Not supported
ERR_EXIST -210 The specified data already exists.
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
Call this function to set the printer status to wStatus and call the callback function. When the ink status
changes, new information is automatically set to wStatus and the callback function is called. Cancel this func-
tion using BiCancelInkStatusBack.
Refer to “Printer Specification” regarding the ink status that can be acquired by each printer.

Status API cannot be used within the registered callback function.

59
Chapter 3 Reference for Win32

BiSetInkStatusBackFunctionEx
Automatically acquires the ink status using the callback function when the ink status changes.
Identifies the printer port originating the callback, in addition to the functions of BiSetInkStatusBackFunction.

This is unavailable when the development environment is VB 6.0.

Syntax
int BiSetInkStatusBackFunctionEx
(int nHandle, int (CALLBACK EXPORT *pStatusCB)
(WORD wStatus, LPSTR lpcPortName))

Parameter
nHandle: Specifies the handle.
*pStatusCB: Specifies the definition address of the callback function.

Parameter of call back function


wStatus: Automatically returns the ink status. The ink status is a 2 byte configuration.
lpcPortName: Returns the printer port name originating the callback. 3
Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_PARAM -90 Parameter error
ERR_NOT_SUPPORT -100 Not supported
ERR_EXIST -210 The specified data already exists.
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
Call this function to set the ink status to wStatus and call the callback function. When the printer status
changes, new information is automatically set to wStatus and the port name of the acquired destination is set to
lpcPortName and the callback function is called. Cancel this function using BiCancelInkStatusBack.
Refer to “Printer Specification” regarding the ink status that can be acquired by each printer.

Status API cannot be used within the registered callback function.

60
Chapter 3 Reference for Win32

BiSetInkStatusBackWnd
Automatically acquires the ink status generating a click event when the ink status changes.

Syntax
int BiSetInkStatusBackWnd (int nHandle, long hWnd, LPWORD lpStatus)

Parameter
nHandle: Specifies the handle.
hWnd: Specifies the window handle of the button generating the click event.
lpStatus: Automatically returns the ink status. The ink status is a 2 byte configuration.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_PARAM -90 Parameter error
ERR_NOT_SUPPORT
ERR_EXIST
-100
-210
Not supported
The specified data already exists.
3
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
Refer to “Printer Specification” regarding the ink status that can be acquired by each printer.

Status API cannot be used from the specified window handle.

61
Chapter 3 Reference for Win32

BiCancelInkStatusBack
Cancels the automatic ink status notification request process called using the BiSetInkStatusBackFunction,
BiSetInkStatusBackFunctionEx, or BiSetInkStatusBackWnd.

Syntax
int BiCancelInkStatusBack (int nHandle)

Parameter
nHandle: Specifies the handle.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_NOT_SUPPORT -100 Not supported
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use

 Returns "SUCCESS" even when called while the automatic ink status notification request process is
3
not registered.
 For information on remedies for the Status API execution errors, refer to "Status API Execution
Error" on page 27.

62
Chapter 3 Reference for Win32

BiGetBatteryStatus
Acquires the printer's current battery status.

Syntax
int BiGetStatus (int nHandle, LPBYTE lpbPowerStatus, LPBYTE lpbBatteryStatus)

Parameter
nHandle: Specifies the handle.
lpbPowerStatus: Specifies the memory address where the power status is set.
lpbBatteryStatus: Specifies the memory address where the remaining amount of the battery is set.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_PARAM -90 Parameter error
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use
3
For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
lpbPowerStatus specifies whether the printer power is supplied from the AC adapter or battery. lpbBatteryStatus
specifies the battery level.
Refer to “Printer Specification” regarding the battery status that can be acquired by each printer.

63
Chapter 3 Reference for Win32

BiSetBatteryStatusBackFunctionEx
Automatically acquires the printer status (ASB status) using the callback function when the printer status
changes. Identifies the printer port originating the callback, in addition to the functions of BiSetStatusBack-
Function.

This is unavailable when the development environment is VB 6.0.

Syntax
int BiSetBatteryStatusBackFunctionEx
(int nHandle, int (CALLBACK EXPORT *pBatteryCB)
(BYTE bPowerStatus, BYTE bBatteryStatus, LPSTR lpcPortName))

Parameter
nHandle: Specifies the handle.
*pBatteryCB: Specifies the definition address of the callback function.

Parameter of call back function


bPowerStatus:
bBatteryStatus:
Sets the value of the power status for lpbPowerStatus, and then sends the event.
Sets the battery status value for lpbBatteryStatus, and then sends the event.
3
lpcPortName: Returns the printer port name originating the callback.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_PARAM -90 Parameter error
ERR_EXIST -210 The specified data already exists.
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
Call this function to set the printer status to bPowerStatus / bBatteryStatus and call the callback function.
When the printer status changes, new information is automatically set to bPowerStatus / bBatteryStatus and
calls the callback function. Cancel this function using BiCancelBatteryStatusBack.
Refer to “Printer Specification” regarding the battery status that can be acquired by each printer.

Status API cannot be used within the registered callback function.

64
Chapter 3 Reference for Win32

BiSetBatteryStatusBackWnd
Automatically generates a click event and acquires the printer status (ASB status) when the printer status
changes.

Syntax
int BiSetBatteryStatusBackWnd
(int nHandle, Long hWnd, LPBYTE lpbPowerStatus,
LPBYTE lpbBatteryStatus, LPSTR lpcPortName)

Parameter
nHandle: Specifies the handle.
hWnd: Specifies the window handle of the button generating the click event.
lpbPowerStatus: Sets the value of the power status for lpbPowerStatus, and then sends the event.
lpbBatteryStatus: Sets the battery status value for lpbBatteryStatus, and then sends the event.
lpcPortName: Copies the port name for lpcPortName, and then sends the event. LpcPortName must have
enough memory to copy the port name including the end NULL.

Return value
Macro Definition
3
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_PARAM -90 Parameter error
ERR_EXIST -210 The specified data already exists.
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
Refer to “Printer Specification” regarding the battery status that can be acquired by each printer.
Cancel this function using BiCancelBatteryStatusBack.

Status API cannot be used from the specified window handle.

65
Chapter 3 Reference for Win32

BiCancelBatteryStatusBack
Cancels the automatic status notification request process called using the BiSetBatteryStatusBackFunctionEx, or
BiSetBatteryStatusBackWnd function.

Syntax
int BiCancelBatteryStatusBack (int nHandle)

Parameter
nHandle: Specifies the handle.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use

 Returns "SUCCESS" even when executed when the automatic status notification request process is
not registered.
 For information on remedies for the Status API execution errors, refer to "Status API Execution
3
Error" on page 27.

66
Chapter 3 Reference for Win32

BiPowerOff
Updates the maintenance counter and prepares to turn off the power to the printer.
Cannot turn off the power to the printer.

Cannot call when in online recovery standby.

Syntax
int BiPowerOff (int nHandle)

Parameter
nHandle: Specifies the handle.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_NO_MEMORY -50 Not enough memory
ERR_HANDLE
ERR_TIMEOUT
-60
-70
Specified handle is invalid
Timeout error
3
ERR_ACCESS -80 Access cannot be performed on the printer
ERR_NOT_SUPPORT -100 Not supported
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client
of PortHandler and the server.
ERR_LOCKED -1000 The printer is locked.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

67
Chapter 3 Reference for Win32

BiAutoPowerOffTime
Acquires and sets the time until the mobile printer is turned off. Cannot turn off the power to the printer.

Syntax
int BiAutoPowerOffTime (int nHandle, BYTE bMode, LPBYTE lpbTime)

Parameter
nHandle: Specifies the handle.
bMode: Specifies the process mode.
Macro Definition
Value Description
(Constant)
EPS_BI_GET 0 Acquires the auto power off time.
EPS_BI_SET 1 Sets the auto power off time.

lpbTime: Specifies the memory address to set the auto power off time.

Return value
Macro Definition
(Constant)
Value Description 3
SUCCESS 0 Success
ERR_NO_MEMORY -50 Not enough memory
ERR_HANDLE -60 Specified handle is invalid
ERR_TIMEOUT -70 Timeout error
ERR_ACCESS -80 Access cannot be performed on the printer
ERR_NOT_SUPPORT -100 Not supported
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client
of PortHandler and the server.
ERR_LOCKED -1000 The printer is locked.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
The following items are set in the address specified by lpbTime.
Value Description
0 Auto power off: disabled
1 - 60 1 to 60 minutes

68
Chapter 3 Reference for Win32

BiGetCounter
Acquires the maintenance counter value.

 For information on the counter number and the maintenance counters that can be acquired, refer
to “Printer Specification”.
 The maintenance counter may not be available according to the printer. In this case, a timeout error
is generated.
 Confirm that the ASB status is online before calling this function.

Syntax
int BiGetCounter (int nHandle, WORD readno, LPDWORD readcounter)
Parameter
nHandle: Specifies the handle.
readno: Specifies the acquired maintenance counter number.
readcounter: Returns the maintenance counter.

Return value
Macro Definition
(Constant)
SUCCESS
Value

0 Success
Description
3
ERR_HANDLE -60 Specified handle is invalid
ERR_TIMEOUT -70 Timeout error
ERR_ACCESS -80 Access cannot be performed on the printer
ERR_PARAM -90 Parameter error
ERR_NOT_SUPPORT -100 Not supported
ERR_EXEC_FUNCTION -310 This function is unavailable as Status API is used by other applications.
ERR_EXEC_MICR -320 Cannot call as the MICR is reading
ERR_EXEC_SCAN -330 Cannot call as the scanner is scanning
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client
of PortHandler and the server.
ERR_RESET -400 Cannot call as the printer is restarting
ERR_LOCKED -1000 The printer is locked.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

69
Chapter 3 Reference for Win32

Comment
There are two types of maintenance counters; those that can be reset by the user, and integrated counters that
cannot be reset.
The following operations are executed according to the printer status when this function is called.
Printer Status Operation
Online Returns "SUCCESS" to the return value. Acquires the maintenance counter value.
Offline Returns "ERR_TIMEOUT" to the return value. Does not acquire the maintenance counter value.
Cable Removed/ Returns "ERR_ACCESS" to the return value.
Power Off Does not acquire the maintenance counter value.
Printing Returns "ERR_ACCESS" to the return value.
Does not acquire the maintenance counter value.

70
Chapter 3 Reference for Win32

BiResetCounter
Resets the maintenance counter.

 For information on the counter number and the maintenance counters that can be reset, refer to
“Printer Specification”.
 The maintenance counter may not be available according to the printer. In this case, a timeout error
is generated.
 Confirm that the ASB status is online before calling this function.

Syntax
int BiResetCounter (int nHandle, WORD writeno)

Parameter
nHandle: Specifies the handle.
writeno: Specifies the maintenance counter number to be reset.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success 3
ERR_HANDLE -60 Specified handle is invalid
ERR_TIMEOUT -70 Timeout error
ERR_ACCESS -80 Access cannot be performed on the printer
ERR_PARAM -90 Parameter error
ERR_NOT_SUPPORT -100 Not supported
ERR_EXEC_FUNCTION -310 This function is unavailable as Status API is used by other applications.
ERR_EXEC_MICR -320 Cannot call as the MICR is reading
ERR_EXEC_SCAN -330 Cannot call as the scanner is scanning
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client
of PortHandler and the server.
ERR_RESET -400 Cannot call as the printer is restarting
ERR_LOCKED -1000 The printer is locked.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

71
Chapter 3 Reference for Win32

Comment
If "SUCCESS" is the return value of return value and the value acquired by BiGetCounter after resetting the
maintenance counter, this confirms normal execution.
The following operations are executed according to the printer status when this function is called.
Printer Status Operation
Online Returns "SUCCESS" to the return value. Resets the maintenance counter.
Offline Returns "ERR_TIMEOUT" to the return value. Does not reset the maintenance
counter.
Cable Removed/Power Off Returns "ERR_ACCESS" to the return value. Does not reset the maintenance
counter.
Printing Returns "ERR_ACCESS" to the return value. Does not reset the maintenance
counter.

72
Chapter 3 Reference for Win32

BiGetPrnCapability
Acquires the specified printer information in printer ID.

 For information on the Printer Capability that can be acquired, ask your dealer.
 There are printer ID's that are not supported by printers. If unsupported printer ID's are specified, a
timeout error is generated.

Syntax
int BiGetPrnCapability (int nHandle, BYTE prnID, LPBYTE pBuffSize, LPBYTE pBuff)

Parameter
nHandle: Specifies the handle.
prnID: Specifies the acquiring printer information.
pBuffSize: Specifies the memory size to set the printer information (1 to 80). Returns the actual read data
size after calling this function. In the case of insufficient buffer capacity, the required byte size
is returned.
pBuff: Specifies the memory address to set the printer information.

Return value
Macro Definition
3
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_TIMEOUT -70 Timeout error
ERR_ACCESS -80 Access cannot be performed on the printer
ERR_PARAM -90 Parameter error
ERR_BUFFER_OVER_FLOW -140 Lack of buffer capacity.
ERR_EXEC_FUNCTION -310 This function is unavailable as Status API is used by other applications.
ERR_EXEC_MICR -320 Cannot call as the MICR is reading
ERR_EXEC_SCAN -330 Cannot call as the scanner is scanning
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the cli-
ent of PortHandler and the server.
ERR_RESET -400 Cannot call as the printer is restarting
ERR_LOCKED -1000 The printer is locked.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

73
Chapter 3 Reference for Win32

BiOpenDrawer
Opens the drawer.

Opens the drawer even when the printer is offline.

Syntax
int BiOpenDrawer (int nHandle, BYTE drawer, BYTE pulse)

Parameter
nHandle: Specifies the handle.
drawer: Specifies the drawer to open.
Macro Definition
Value Description
(Constant)
EPS_BI_DRAWER_1 1 Opens drawer 1
EPS_BI_DRAWER_2 2 Opens drawer 2

pulse: Specifies the time when the drawer kick signal is on.
Macro Definition
(Constant)
Value Description 3
EPS_BI_PLUSE_100 1 Signal for 100 milliseconds
EPS_BI_PLUSE_200 2 Signal for 200 milliseconds
EPS_BI_PLUSE_300 3 Signal for 300 milliseconds
EPS_BI_PLUSE_400 4 Signal for 400 milliseconds
EPS_BI_PLUSE_500 5 Signal for 500 milliseconds
EPS_BI_PLUSE_600 6 Signal for 600 milliseconds
EPS_BI_PLUSE_700 7 Signal for 700 milliseconds
EPS_BI_PLUSE_800 8 Signal for 800 milliseconds

74
Chapter 3 Reference for Win32

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_ACCESS -80 Access cannot be performed on the printer
ERR_PARAM -90 Parameter error
ERR_NOT_SUPPORT -100 Not supported
ERR_EXEC_FUNCTION -310 This function is unavailable as Status API is used by other applications.
ERR_EXEC_MICR -320 Cannot call as the MICR is reading
ERR_EXEC_SCAN -330 Cannot call as the scanner is scanning
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client
of PortHandler and the server.
ERR_RESET -400 Cannot call as the printer is restarting
ERR_LOCKED -1000 The printer is locked.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment 3
The following operations are executed according to the printer status when this function is called.
Printer Status Operation
Online Returns "SUCCESS" to the return value. Opens the drawer.
Offline Returns "SUCCESS" to the return value. Opens the drawer.
Cable Removed/Power Off Returns "ERR_ACCESS" to the return value. Does not open the drawer.

75
Chapter 3 Reference for Win32

BiSendDataFile
Specify the command definition file to define the transmission command (ESC/POS command).

Refer to the following URL for details of the ESC/POS command.


https://reference.epson-biz.com/modules/ref_escpos/index.php?content_id=2

Syntax
int BiSendDataFile (int nHandle, LPCSTR lpcFileName)

Parameter
nHandle: Specifies the handle.
lpcFileName: Specifies the command definition file name.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_NO_MEMORY -50 Not enough memory
ERR_HANDLE
ERR_PARAM
-60
-90
Specified handle is invalid
Parameter error
3
ERR_BUFFER_OVER_FLOW -140 Lack of buffer capacity.
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

76
Chapter 3 Reference for Win32

Comment
Describe the command definition file using the following format.
 The character string listed to the left of "=" is the "command name" of the data to be written to the printer and
the character string listed to the right of "=" is the "registered transmission data".
Command Name
ABC=xx xx xx xx xx
Registered Transmission Data(ESC/POS command)

 Handle character strings following "#" as comments.


 Ensure that character strings are listed using parentheses (" ").
 List binary data as two digit hexadecimals.
 The maximum size of "command names" is 33 bytes (33 characters in ANK).
 The maximum size of "registered transmission data" is 10,240 bytes. However, the size of the "registered
transmission data" is not the length of an "ASCIIZ character string" but the size after converting the data to
binary. Refer to the following examples.
ABC="ABC" : The maximum size of "registered transmission data" is 3 bytes.
ABC="ABC" xx xx : The maximum size of "registered transmission data" is 5 bytes.
ABC=xx xx xx xx xx : The maximum size of "registered transmission data" is 5 bytes.

 If a command name is already registered, stop the command registration process and return an error.
 The number of commands that can be registered is limited to the usable memory of the system.
 Call the BiCloseMonPrinter function to cancel the registered command data.
3

77
Chapter 3 Reference for Win32

BiDirectSendRead
Executes the command defined in BiSendDataFile(ESC/POScommands).

Refer to the following URL for details of the ESC/POS command.


https://reference.epson-biz.com/modules/ref_escpos/index.php?content_id=2

Syntax
int BiDirectSendRead (int nHandle, LPCSTR lpcCmdName,
LPCSTR lpcReadName, LPDWORD lpdwLength,
LPBYTE lpbReadBuf, DWORD dwTimeout,
BOOL blNullTerminate)

Parameter
nHandle: Specifies the handle.
lpcCmdName: Specifies the "command name" of the command definition file name.
lpcReadName: Specifies the "receiving data type name" of the data read from the printer. Refer to Page
"BiSendDataFile" on page 76.
lpdwLength: Specifies the data length read from the printer. Does not write to the printer when "0".

lpbReadBuf:
Returns the data length when reading.
Specifies the buffer saving the data read from the printer.
3
dwTimeout: Specifies the timeout time in ms (milliseconds).
blNullTerminate: In the case of "TRUE", reading is complete when NULL is received from the printer. At this
time, specify the lpbReadBuf size to readLen.
In the case of "FALSE ", the length of data specified in lpdwLength is read or data is read
from the printer until a timeout error is generated.

Ensure that the size of lpbReadBuf is the same length specified in lpdwLength or longer.

78
Chapter 3 Reference for Win32

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_NO_MEMORY -50 Not enough memory
ERR_HANDLE -60 Specified handle is invalid
ERR_TIMEOUT -70 Timeout error
ERR_ACCESS -80 Access cannot be performed on the printer
ERR_PARAM -90 Parameter error
ERR_BUFFER_OVER_FLOW -140 Lack of buffer capacity.
ERR_EXEC_FUNCTION -310 This function is unavailable as Status API is used by other applications.
ERR_EXEC_MICR -320 Cannot call as the MICR is reading
ERR_EXEC_SCAN -330 Cannot call as the scanner is scanning
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client
of PortHandler and the server.
ERR_RESET -400 Cannot call as the printer is restarting
ERR_LOCKED -1000 The printer is locked.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.
3

79
Chapter 3 Reference for Win32

Comment
This function specifies the name (macro name) previously specified in the command definition file. The follow-
ing data types can be specified as responses from the printer.
Data Types Description
ASB Automatic status transmission
ASB Extended Automatic status transmission regarding extended status
Ptr Info Byte Printer ID information
Ptr Info String Printer information B
Power OFF Power OFF notification
Power ON Power ON notification
Realtime Realtime transmission of status
Buffer Clear Buffer clear
Slip Remaining Dot count transmission of remaining print area of a single-cut sheet
NVM Image Size Transmission of full capacity of NV graphics area
NVM Image Free Transmission of remaining capacity of NV graphics area
NVM Image Keys Transmission of the key code list of defined NV graphics
NVM Image List Transmission of the data ID list of image reading results saved to NV memory for storage
NVM User Used Transmission of usage capacity (byte count of used area)
NVM User Free
NVM User Get
Transmission of remaining capacity (byte count of unused area)
Transmission of the storage data of a specified record 3
NVM User Keys Transmission of the key code list of a storage record
NVM Set Mode Transmission of transfer notification to user settings mode
NVM Get Mswitch Transmission of memory switch values
NVM Set Size Transmission of customized values
ASB Ink Automatic status transmission regarding ink
Ptr Info Type A Printer information A
Test Print Execution of test print
RAM Image Free Transmission of remaining area of download graphics area
RAM Image Keys Transmission of the key code list of defined download graphics
OfflineCode Bit Transmission of offline response (bit format)
OfflineCode Data Transmission of offline response (data format)
ProcessID Transmission of process ID response
Data Types Description
Buffer Clear24 Buffer clear 24
Other Data not applicable to the aforementioned

80
Chapter 3 Reference for Win32

BiSetDefaultEchoTime
Configures the response confirmation frequency of the network printer and the initial time value for a single
timeout.

 Can only be used when connected by Ethernet.


 Use the default value (BiSetDefaultEchoTime) setting.
 The configuration with this API will be valid after restart the computer.

Syntax
int BiSetDefaultEchoTime (BYTE Count, WORD Timeout)

Parameter
Count: Configures the response confirmation frequency (1 to 255).
Timeout: Configures the single timeout time (1 to 65535) in ms (millisecond) units.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS
ERR_PARAM
0
-90
Success
Parameter error
3
ERR_EXEC_FUNCTION -310 This function is unavailable as Status API is used by other applications.
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client of
PortHandler and the server.

 For information on remedies for the Status API execution errors, refer to "Status API Execution
Error" on page 27.
 When a shred printer is accessed from a client that does not have PortHandler, the printer returns
ERR_PH_NOT_EXIST.

Comment
The response confirmation frequency is three times and the timeout time is 1 second immediately after install-
ing Status API.
The configuration with this API will be valid to all of the TM printers (w/Ethernet Port) which are connected to
the computer.

81
Chapter 3 Reference for Win32

BiSetEtherEchoTime
Configures the response confirmation frequency of the network printer and the timeout time for one time after
Status API is available.

 Can only be used when connected by Ethernet.


 Use the default value (BiSetDefaultEchoTime) setting.

Syntax
int BiSetEtherEchoTime (int nHandle, BYTE Count, WORD Timeout)

Parameter
nHandle: Specifies the handle.
Count: Configures the response confirmation frequency (1 to 255).
Timeout: Configures the single timeout time (1 to 65535) in ms (millisecond) units.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS
ERR_HANDLE
0
-60
Success
Specified handle is invalid
3
ERR_ACCESS -80 Access cannot be performed on the printer
ERR_PARAM -90 Parameter error
ERR_NOT_SUPPORT -100 Not supported
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client of
PortHandler and the server.
ERR_LOCKED -1000 The printer is locked.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
If a value is not configured to this function, the value set in the BiSetDefaultEchoTime function is used.

82
Chapter 3 Reference for Win32

BiMICRCleaning
Cleans the MICR mechanism.

Syntax
int BiMICRCleaning (int nHandle)

Parameter
nHandle: Specifies the handle.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_TIMEOUT -70 Timeout error
ERR_ACCESS -80 Access cannot be performed on the printer
ERR_NOT_SUPPORT -100 Not supported
ERR_EXEC_FUNCTION
ERR_EXEC_MICR
-310
-320
Cannot call as another Status API is in use
Cannot call as the MICR is reading
3
ERR_EXEC_SCAN -330 Cannot call as the scanner is scanning
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client of
PortHandler and the server.
ERR_RESET -400 Cannot call as the printer is restarting
ERR_LOCKED -1000 The printer is locked.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
If this function is called, the mechanism waits for the cleaning sheet to be inserted. Insert the cleaning sheet and
carry out cleaning of the mechanism. After cleaning is finished, the MICR function is deselected.

83
Chapter 3 Reference for Win32

BiMICRGetStatus
Specifies the memory address where the MICR status is set.

Syntax
int BiMICRGetStatus (int nHandle, LPBYTE pStatus)

Parameter
nHandle: Specifies the handle.
pStatus: Specifies the memory address where the MICR status is set.
See the following MICR states concerning the types of MICR status that are returned.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_TIMEOUT -70 Timeout error
ERR_ACCESS
ERR_PARAM
-80
-90
Access cannot be performed on the printer
Parameter error
3
ERR_NOT_SUPPORT -100 Not supported
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use
ERR_EXEC_SCAN -330 Cannot call as the scanner is scanning
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client of
PortHandler and the server.
ERR_RESET -400 Cannot call as the printer is restarting
ERR_LOCKED -1000 The printer is locked.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
For the MICR statuses that can be acquired from each printer, refer to "Printer Specifications".

84
Chapter 3 Reference for Win32

BiMICRLoadCheck
Loads the check to the check print start position.

Syntax
int BiMICRLoadCheck (int nHandle)

Parameter
nHandle: Specifies the handle.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_TIMEOUT -70 Timeout error
ERR_ACCESS -80 Access cannot be performed on the printer
ERR_NOT_SUPPORT -100 Not supported
ERR_EXEC_FUNCTION
ERR_EXEC_MICR
-310
-320
Cannot call as another Status API is in use
Cannot call as the MICR is reading
3
ERR_EXEC_SCAN -330 Cannot call as the scanner is scanning
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client of
PortHandler and the server.
ERR_RESET -400 Cannot call as the printer is restarting
ERR_LOCKED -1000 The printer is locked.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

85
Chapter 3 Reference for Win32

BiMICRReadCheck
Executes the MICR reading for checks.

Syntax
int BiMICRReadCheck (int nHandle, BYTE readFont, BYTE waitInsertionTime)

Parameter
nHandle: Specifies the handle.
readFont: Specifies the reading font.
Value Description
0 E13B
1 CMC7

waitInsertionTime: Specifies the check insertion wait time. The printer's default is 0.
Value Description
0 waitInsertionTime: disabled.
Continues the check paper insertion standby status.
1 to 15 1 to 15 minutes
3
Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_TIMEOUT -70 Timeout error
ERR_ACCESS -80 Access cannot be performed on the printer
ERR_PARAM -90 Parameter error
ERR_NOT_SUPPORT -100 Not supported
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use
ERR_EXEC_MICR -320 Cannot call as the MICR is reading
ERR_EXEC_SCAN -330 Cannot call as the scanner is scanning
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client of
PortHandler and the server.
ERR_RESET -400 Cannot call as the printer is restarting
ERR_LOCKED -1000 The printer is locked.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
The standby time for check paper insertion after MICR reading is completed is reset to 0, the printer default.
Be sure to call either BiMICRSetReadBackFunction/ BiMICRSetReadBackFunctionEx/ BiMICRSetReadBack-
Wnd before calling this function.

86
Chapter 3 Reference for Win32

BiMICREjectCheck
Ejects the check.

Syntax
int BiMICREjectCheck (int nHandle)

Parameter
nHandle: Specifies the handle.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_TIMEOUT -70 Timeout error
ERR_ACCESS -80 Access cannot be performed on the printer
ERR_NOT_SUPPORT -100 Not supported
ERR_EXEC_FUNCTION
ERR_EXEC_MICR
-310
-320
Cannot call as another Status API is in use
Cannot call as the MICR is reading
3
ERR_EXEC_SCAN -330 Cannot call as the scanner is scanning
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client of
PortHandler and the server.
ERR_RESET -400 Cannot call as the printer is restarting
ERR_LOCKED -1000 The printer is locked.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

87
Chapter 3 Reference for Win32

BiMICRCancelWaitCheckInsertion
Cancels check insertion wait.

Syntax
int BiMICRCancelWaitCheckInsertion (int nHandle)

Parameter
nHandle: Specifies the handle.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_TIMEOUT -70 Timeout error
ERR_ACCESS -80 Access cannot be performed on the printer
ERR_NOT_SUPPORT -100 Not supported
ERR_EXEC_FUNCTION
ERR_EXEC_MICR
-310
-320
Cannot call as another Status API is in use
Cannot call as the MICR is reading
3
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client of
PortHandler and the server.
ERR_RESET -400 Cannot call as the printer is restarting
ERR_LOCKED -1000 The printer is locked.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

88
Chapter 3 Reference for Win32

BiMICRRetransmissionCheckData
Resends the check reading results.

Syntax
int BiMICRRetransmissionCheckData (int nHandle, LPBYTE pReadBuffSize,
LPBYTE readCharBuff, LPBYTE pStatus, LPBYTE pDetail, DWORD timeout)

Parameter
nHandle: Specifies the handle.
pReadBuffSize: Specifies the size of memory where the reading data are set. After this function is executed, the
size of the actual reading data is set.
readCharBuff: Specifies the memory addresses where the reading data are set.
pStatus: Specifies a 1‐byte memory address where the reading status is set.
pDetail: Specifies a 1‐byte memory address that sets detailed information after a returned reading error
in the case that addition of detailed information is specified by the BiMICRSelectDataHandling
function.
timeout: Specifies the timeout time for data reading in msec units.
As this parameter is a DWORD type, any negative values specified are handled as positive val-
ues.
3
Example: If you specified -200, in DWORD, it is FFFFFF38h, and it is handled as 4294967096
msec.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_TIMEOUT -70 Timeout error
ERR_ACCESS -80 Access cannot be performed on the printer
ERR_PARAM -90 Parameter error
ERR_NOT_SUPPORT -100 Not supported
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use
ERR_EXEC_MICR -320 Cannot call as the MICR is reading
ERR_EXEC_SCAN -330 Cannot call as the scanner is scanning
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client of
PortHandler and the server.
ERR_RESET -400 Cannot call as the printer is restarting
ERR_LOCKED -1000 The printer is locked.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

89
Chapter 3 Reference for Win32

Comment
If the reading data overflows, the 6th bit of the MICR reading status turns ON (reading data overflow).
If this function is called when check reading is not executed by the BiMICRReadCheck function, the reading
data is not set, and the reading status ends with an error.

90
Chapter 3 Reference for Win32

BiMICRSelectDataHandling
Selects the check reading operation.

Syntax
int BiMICRSelectDataHandling (int nHandle, BYTE charSelect, BYTE detailSelect,
BYTE errorSelect)

Parameter
nHandle: Specifies the handle.
charSelect: Specifies handling of characters that cannot be analyzed.
Value Description
0 Interrupts analysis processing at the point when characters that cannot be analyzed are
detected and doesn’t add the reading data.
1 Replaces characters which cannot be analyzed with a '?' and continues analysis process-
ing, then if the reading data size is at or less than the reading data size specified in BiMI-
CRSetReadBackFunction/ BiMICRSetReadBackWnd, the reading data are added.

detailSelect: Specifies whether or not to add detailed information after a reading error.
Value
0 Detailed information is not added.
Description 3
1 Detailed information is added.

errorSelect: Specifies whether or not to end the MICR function or continue it after an error.
Furthermore, the MICR function continues regardless of this setting if reading ends normally
or when the function ends with an error with detailSelect(1) set.
Value Description
0 MICR function ends only when the function ends with an error with detailSelect(1) set.
1 If reading ends due to an error caused by any of the following causes, the MICR function
continues even after notification of the reading results.
 A check with a non-standard length is inserted.
 The magnetic waveform cannot be detected.
 Characters which cannot be analyzed are detected in analysis processing.
 Errors were detected in the noise measurements.

91
Chapter 3 Reference for Win32

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_TIMEOUT -70 Timeout error
ERR_ACCESS -80 Access cannot be performed on the printer
ERR_PARAM -90 Parameter error
ERR_NOT_SUPPORT -100 Not supported
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use
ERR_EXEC_MICR -320 Cannot call as the MICR is reading
ERR_EXEC_SCAN -330 Cannot call as the scanner is scanning
ERR_PH_NOT_EXIST -340 The PortHandler is not running or a communication error between the client of
PortHandler and the server.
ERR_RESET -400 Cannot call as the printer is restarting
ERR_LOCKED -1000 The printer is locked.

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

92
Chapter 3 Reference for Win32

BiMICRSetReadBackFunction
Executes reading of checks by BiMICRReadCheck and registers the address of the callback function when the
results are notified as well as the memory addresses where each type of information read from the check is set.

Syntax
int BiMICRSetReadBackFunction
(int nHandle, INT (CALLBACK EXPORT *pMicrCB)(VOID),
LPBYTE pReadBuffSize, LPBYTE readCharBuff, LPBYTE pStatus,
LPBYTE pDetail)

Parameter
nHandle: Specifies the handle.
(CALLBACK EXPORT * pMicrCB)(VOID):
Specifies the address of the callback function for notifying the results from reading of a check.
pReadBuffSize: Specifies the size of the memory where the reading data are set. After execution of this func-
tion, the size of the data which were actually read is set.
readCharBuff: Specifies the memory address where the check reading data are set.
pStatus:
pDetail:
Specifies a 1‐byte memory address where the MICR reading status is stored.
Specifies a 1‐byte memory address in which reading of a check ends in an error, which is
3
returned in cases where detailed information is added in accordance with the BiMICRSelect-
DataHandling function.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_PARAM -90 Parameter error
ERR_NOT_SUPPORT -100 Not supported
ERR_EXIST -210 The specified data already exists.
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
For the MICR information and MICR reading status of each TM printer, refer to "Printer Specifications".

93
Chapter 3 Reference for Win32

BiMICRSetReadBackFunctionEX
Executes reading of checks with the BiMICRReadCheck function and registers the address of the callback func-
tion to be called when the results are notified, as well as the memory address where each type of the information
read is to be set. Also returns the pointer to the port name to recognize from which port the callback is.

Syntax
int BiMICRSetReadBackFunctionEx
(int nHandle, INT (CALLBACK EXPORT *pMicrCB)(LPSTR lpcPortName),
LPBYTE pReadBuffSize,LPBYTE readCharBuff, LPBYTE pStatus,
LPBYTE pDetail)

Parameter
nHandle: Specifies the handle.
(CALLBACK EXPORT * pMicrCB)(LPSTR lpcPortName):
Specifies the address of the callback function for notifying the results from reading of a check.
Sets the port name in lpcPortName and calls the callback function.
pReadBuffSize: Specifies the size of the memory where the reading data are set. After execution of this func-
tion, the size of the data which were actually read is set.
readCharBuff: Specifies the memory address where the check reading data are set. 3
pStatus: Specifies a 1‐byte memory address where the MICR reading status is stored.
pDetail: Specifies a 1‐byte memory address in which reading of a check ends in an error, which is
returned in cases where detailed information is added in accordance with the BiMICRSelect-
DataHandling function.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_PARAM -90 Parameter error
ERR_NOT_SUPPORT -100 Not supported
ERR_EXIST -210 The specified data already exists.
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

94
Chapter 3 Reference for Win32

Comment
Be sure to call this function before calling the BiMICRReadCheck function. Calling the BiMICRReadCheck
function before calling this function returns an error.
If the reading data overflows, the 6th bit of the MICR reading status turns ON (reading data overflow).
For the MICR information and MICR reading status of each TM printer, refer to "Printer Specifications".

95
Chapter 3 Reference for Win32

BiMICRSetReadBackWnd
Executes check reading by BiMICRReadCheck, registers the handle of a button which sends the button’s click
event when the results are notified, and registers the memory addresses where each type of reading information
is set.

Syntax
int BiMICRSetReadBackWnd (int nHandle, HWND hWnd,
LPBYTE pReadBuffSize,LPBYTE readCharBuff, LPBYTE pStatus, LPBYTE pDetail)

Parameter
nHandle: Specifies the handle.
hWnd: Specifies the button handle. Sends the click event to this button.
pReadBuffSize: Specifies the size of memory where the reading data are set. after this function is executed, the
size of the actual reading data is set.
readCharBuff: Specifies the memory addresses where the reading data are set.
pStatus: Specifies a 1‐byte memory address where the MICR reading status is set.
pDetail: Specifies a 1‐byte memory address that sets detailed information after a returned reading error
in the case that addition of detailed information is specified by the BiMICRSelectDataHandling
function.
3
Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_PARAM -90 Parameter error
ERR_NOT_SUPPORT -100 Not supported
ERR_EXIST -210 The specified data already exists.
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

Comment
Be sure to call this function before calling the BiMICRReadCheck function. Calling the BiMICRReadCheck
function before calling this function returns an error.
If the reading data overflows, the 6th bit of the MICR reading status turns ON (reading data overflow).
For the MICR information and MICR reading status of each TM printer, refer to "Printer Specifications".

96
Chapter 3 Reference for Win32

BiMICRCancelReadBack
Cancels a reading information notification request registered using
BiMICRSetReadBackFunction, BiMICRSetReadBackFunctionEx or BiMICRSetReadBackWnd.

Syntax
int BiMICRCancelReadBack (int nHandle)

Parameter
nHandle: Specifies the handle.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success
ERR_HANDLE -60 Specified handle is invalid
ERR_NOT_SUPPORT -100 Not supported
ERR_EXEC_FUNCTION -310 Cannot call as another Status API is in use
ERR_EXEC_MICR -320 Cannot call as the MICR is reading
3
For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

97
Chapter 3 Reference for Win32

BiSetReadWaitTimeOut
This is a compatible API. This API itself has no function.

Syntax
int BiSetReadWaitTimeOut (int nHandle, WORD wTimeOut)

Parameter
nHandle: Specifies the handle.
wTimeOut: Not used.

Return value
Macro Definition
Value Description
(Constant)
SUCCESS 0 Success

For information on remedies for the Status API execution errors, refer to "Status API Execution Error"
on page 27.

98
Chapter 4 Reference for .NET

Reference for .NET


This chapter explains Status API and the syntax used in .NET environment.

Properties

AutoPowerOffTime
Acquires and sets the time until the mobile printer is turned off.
For details, see "BiAutoPowerOffTime" on page 68.
Access: Read/Write
Data type: int

InkStatus
Acquires the current ink status.
Access: Read only
Data type: com.epson.pos.driver.InkASB

Explanation
Constants defined in com.epson.pos.driver.InkASB shall be used for the value, see "BiGetInkStatus" on page 58.
4
IsValid
Acquires the open status of the printer.
Access: Read only
Data type: System.Boolean

Explanation
Returns either of the following values.
true: Successfully opened.
false: Not opened or failed to be opened.

99
Chapter 4 Reference for .NET

LastError
Acquires the error code of the last executed API.
Access: Read only
Data type: com.epson.pos.driver.ErrorCode

Explanation
Can acquire an error code at any time because this module retains the last executed API.
This method is used to judge success or failure because APIs implemented in properties cannot return error
codes.
Error codes for errors that may occur in all APIs. For details, see "Status API Execution Error" on page 27.

OfflineCode
Acquires the bit that indicates the cause of the printer being offline.
Access: Read only
Data type: System.Byte[]

Explanation
For details, see "BiGetOfflineCode" on page 50.

Status
4
Acquires the current printer status.
Access: Read only
Data type: com.epson.pos.driver.ASB

Explanation
Constants defined in com.epson.pos.driver.ASB shall be used for the value. For details, see "BiGetStatus" on
page 51.

100
Chapter 4 Reference for .NET

Methods

OpenMonPrinter
Starts controlling the specified printer. For details, see "BiOpenMonPrinter" on page 33.

Syntax
ErrorCode OpenMonPrinter (OpenType type, String name)

Parameters
OpenType type: Type of name to be specified for name. Constants defined in
com.epson.pos.driver.OpenType shall be used for the value.
String name: Starts controlling the specified printer.

CloseMonPrinter
Stops controlling the specified printer. For details, see "BiCloseMonPrinter" on page 35.

Syntax
ErrorCode CloseMonPrinter ()
4
LockPrinter
Occupies the printer. For details, see "BiLockPrinter" on page 36.

Syntax
ErrorCode LockPrinter (int timeout)

Parameters
int timeout: Timeout time (in ms units).

101
Chapter 4 Reference for .NET

UnlockPrinter
Stops occupying the printer. For details, see "BiUnlockPrinter" on page 38.

Syntax
ErrorCode UnlockPrinter ()

SetMonInterval
Specifies the interval for Status API to read the status of the printer. For details, see "BiSetMonInterval" on page
39.

Syntax
ErrorCode SetMonInterval (int noPrnInterval, int prnInterval)

Parameters
int noPrnInterval: Unused
int prnInterval: Printer monitoring interval

SetMonEtherInterval
Specifies the interval for Status API to read the status of the printer. For details, see "BiSetMonEtherInterval" on
4
page 40.

Syntax
ErrorCode SetMonEtherInterval(int EtherInterval)

Parameters
int EtherInterval: Network printer monitoring interval

102
Chapter 4 Reference for .NET

DirectIOEx
After sending the specified data to the printer, receives data of the specified length from the printer.
For details, see "BiDirectIOEx" on page 43.

Syntax
• ErrorCode DirectIOEx (byte[] writeCmd, ref byte[] readBuff, int timeout,
bool nullTerminate, byte option)
Description: Sends the ESC/POS commands to the TM printer and receives the execution result (binary
data) from the printer.
• ErrorCode DirectIOEx (byte[] writeCmd, out String response, int timeout,
byte option)
Description: Sends the ESC/POS commands to the TM printer and receives the execution result (character
string data) from the printer.
• ErrorCode DirectIOEx (byte[] writeCmd, int timeout)
Description: Only sends the ESC/POS commands to the TM printer. Receives neither the execution result
nor ASB statuses from the printer.

Parameters
byte[] writeCmd: Data to be sent to the printer
ref byte[] readBuff: Data received from the printer
int timeout: Timeout time for data transmission and reception (in ms units) 4
bool nullTerminate: Whether or not to terminate reception when NULL is received
byte option: In the case of "True", reading is complete when NULL is received from the printer. At
this time, specify the readBuff size to readLen.
In the case of "False", the length of data specified in readLen is read or data is read from
the printer until a timeout error is generated.
out String response: Data received from the printer (to be converted into strings)

103
Chapter 4 Reference for .NET

ResetPrinter
Resets the printer. When resetting the printer during printing, cancels print jobs and performs printer resetting.
For details, see "BiResetPrinter" on page 46.

Syntax
ErrorCode ResetPrinter()

ForceResetPrinter
Forces to reset the TM printer whose status is being monitored.
Can reset also the TM printers occupied with LockPrinter. This also resets TM printers during printing. Be
careful in using this API. For details, see "BiForceResetPrinter" on page 47.

Syntax
ErrorCode ForceResetPrinter()

CancelError
Performs recovery from a printer recoverable error. For details, see "BiCancelError" on page 48.

Syntax
4
ErrorCode CancelError()

104
Chapter 4 Reference for .NET

GetType
Acquires the type ID of the printer. For details, see "BiGetType" on page 49.

Syntax
ErrorCode GetType (out byte typeid, out byte font,
out byte exrom, out byte euspecial)

Parameters
out byte typeid: Type ID of the printer
out byte font: Fonts installed in the printer
out byte exrom: Capacity of the printer’s extended Flash ROM.
out byte euspecial: Special ID of the printer

GetRealStatus
Acquires the most recent status of the printer. Individual bits in the status correspond to the contents of the ASB
status and constants defined in com.epson.pos.driver. ASB shall be used.
For details, see "BiGetRealStatus" on page 52.

Syntax
ErrorCode GetRealStatus (out ASB asb) 4
Parameters
out ASB asb: Current printer status

SetStatusBack
Starts status notification through StatusCallback/StatusCallbackEx events.
For details, see "BiSetStatusBackFunctionEx" on page 54.

Syntax
ErrorCode SetStatusBack ()

105
Chapter 4 Reference for .NET

CancelStatusBack
Stops status notification through StatusCallback/StatusCallbackEx events.
For details, see "BiCancelStatusBack" on page 56.

Syntax
ErrorCode CancelStatusBack ()

SetInkStatusBack
Starts status notification through InkStatusCallback/InkStatusCallbackEx events.
For details, see "BiSetInkStatusBackFunctionEx" on page 60.

Syntax
ErrorCode SetInkStatusBack ()

CancelInkStatusBack
Stops status notification through InkStatusCallback/InkStatusCallbackEx events.
For details, see "BiCancelInkStatusBack" on page 62.
4
Syntax
ErrorCode CancelInkStatusBack ()

GetBatteryStatus
Acquires the current printer's battery status.
For details, see "BiGetBatteryStatus" on page 63.

Syntax
ErrorCode GetBatteryStatus (ref PowerStatus lpbPowerStatus,
ref BatteryStatus lpbBatteryStatus)

106
Chapter 4 Reference for .NET

SetBatteryStatusBack
Starts battery status notification through a BatteryStatusCallbackEx event.
For details, see "BiSetBatteryStatusBackFunctionEx" on page 64.

Syntax
ErrorCode SetBatteryStatusBack ()

CancelBatteryStatusBack
Stops battery status notification through a BatteryStatusCallbackEx event.
For details, see "BiCancelBatteryStatusBack" on page 66.

Syntax
ErrorCode CancelBatteryStatusBack ()

PowerOff
Executes the power-off process of the printer. For details, see "BiPowerOff " on page 67.

Syntax 4
ErrorCode PowerOff ()

107
Chapter 4 Reference for .NET

GetCounter
Reads the maintenance counter. For details, see "BiGetCounter" on page 69.

Syntax
• ErrorCode GetCounter (CounterIndex counter, bool cumulative, out int value)
Description: With the combination of CounterIndex counter and bool cumulative, calculates the counter
number and acquires the value of the counter.
• ErrorCode GetCounter (byte counter, out int value)
Description: Acquires value of the counter specified with byte counter.

Parameters
CounterIndex counter: Maintenance counter numberConstants defined in com.epson.pos.driver.Coun-
terIndex shall be used for the value.
bool cumulative: Whether or not the maintenance counter number specified by counter refers to the
cumulative counter
true: cumulative counter
false: reset counter
out int value: Maintenance counter value
byte counter: Maintenance counter number

ResetCounter 4
Resets the maintenance counter. For details, see "BiResetCounter" on page 71.

Syntax
• ErrorCode ResetCounter (CounterIndex counter)
Description: Reset the value of counter specified with the com.epson.pos.driver.CounterIndex.
• ErrorCode ResetCounter (byte counter)
Description: Reset the value of counter specified with byte counter.

Parameters
CounterIndex counter: Maintenance counter numberConstants defined in com.epson.pos.driver.Coun-
terIndex shall be used for the value.
byte counter: Maintenance counter number

108
Chapter 4 Reference for .NET

GetPrnCapability
Acquires information about the printer specified by the printer ID. For details, see "BiGetPrnCapability" on
page 73.

Syntax
• ErrorCode GetPrnCapability (byte printerID, out byte[] data)
Description: Acquires information (binary data) of the TM printer specified with printer ID.
• ErrorCode GetPrnCapability (byte printerID, out String data)
Description: Acquires information (character string data) of the TM printer specified with printer ID.

Parameters
byte printerID: ID of the printer from which information is acquired.
out byte[] data: Printer information
out String data: Printer information

OpenDrawer
Activates the drawer. Can be used also when the printer is offline. For details, see "BiOpenDrawer" on page 74.

Syntax
ErrorCode OpenDrawer (Drawer drawer, Pulse pulse)
4
Parameters
Drawer drawer: Drawer to be openedConstants defined in com.epson.pos.driver.Drawer shall be used
for the value.
Pulse pulse: Specifies the time when the drawer kick signal is on.
Constants defined in com.epson.pos.driver.Pulse shall be used for the value.

SendDataFile
Registers commands by using the command definition file. For the file format of the command definition file,
see the descriptions in the subsequent sections. For details, see "BiSendDataFile" on page 76.

Syntax
ErrorCode SendDataFile (String filename)

Parameters
String filename: Command definition file. File in the current folder is used if no path is specified.

109
Chapter 4 Reference for .NET

DirectSendRead
Transmits the commands registered through SendDataFile and receives the data specified with the data type
name of data to be received. For details, see "BiDirectSendRead" on page 78.

Syntax
• ErrorCode DirectSendRead (String cmdName, String readName, ref byte[] readBuf,
int timeout, bool nullTerminate)
Description: Sends a command defined with SendDataFile to a TM printer and receives the execution
result (binary data) from the printer.
• ErrorCode DirectSendRead (String cmdName, String readName,
out String response, int timeout)
Description: Sends a command defined with SendDataFile to a TM printer and receives the execution
result (character string data) from the printer.
• ErrorCode DirectSendRead (String cmdName, String readName, int timeout)
Description: Only sends a command defined with SendDataFile to a TM printer. Not receives the
execution result from the printer.

Parameters
String cmdName: Command name
String readName:
ref byte[] readBuf:
Data type name of data to be received
Received data
4
int timeout: Timeout time for data transmission and data reception (in ms units)
bool nullTerminate: Whether or not to terminate reception when NULL is received.
When “False” is specified, reads as much data as specified with readBuf, or reads data
from the TM printer until a time-out error occurs.
out String response: Received data

110
Chapter 4 Reference for .NET

SetDefaultEchoTime
Sets initial values for the number of response confirmation times and for the timeout time per one response
confirmation, to the network printer. For details, see "BiSetDefaultEchoTime" on page 81.

Syntax
ErrorCode SetDefaultEchoTime (int count, int timeout)

Parameters
int count: Number of response confirmation times (1 to 255)
int timeout: Timeout time (1 to 65535) per one response confirmation (in ms units)

SetEtherEchoTime
Sets values for the number of response confirmation times and for the timeout time per one response confirma-
tion, to the network printer. For details, see "BiSetEtherEchoTime" on page 82.

Syntax
ErrorCode SetEtherEchoTime (int count, int timeout)

Parameters
int count:
int timeout:
Number of response confirmation times (1 to 255)
Timeout time (1 to 65535) per one response confirmation
4
MICRCleaning
Cleans the MICR mechanism. After cleaning is finished, the MICR function is deselected.
For details, see "BiMICRCleaning" on page 83.

Syntax
ErrorCode MICRCleaning ()

111
Chapter 4 Reference for .NET

MICRGetStatus
Acquires the MICR status.
For details, see "BiMICRGetStatus" on page 84.

Syntax
ErrorCode MICRGetStatus (out byte status)

Parameters
out byte status: MICR status

MICRLoadCheck
Loads the check slip into the print start position.
For details, see "BiMICRLoadCheck" on page 85.

Syntax
ErrorCode MICRLoadCheck ()

MICRReadCheck
Reads the check slip.
4
For details, see "BiMICRReadCheck" on page 86.

Syntax
ErrorCode MICRReadCheck (MicrFont readFont, int waitInsertionTime)

Parameters
MicrFont readFont: Read font
int waitInsertionTime: Check slip insertion wait time

MICREjectCheck
Ejects the check slip.
For details, see "BiMICREjectCheck" on page 87.

Syntax
ErrorCode MICREjectCheck ()

112
Chapter 4 Reference for .NET

MICRCancelWaitCheckInsertion
Cancels the check slip insertion wait status.
For details, see "BiMICRCancelWaitCheckInsertion" on page 88.

Syntax
ErrorCode MICRCancelWaitCheckInsertion ()

MICRRetransmitionCheckData
Executes retransmission of the results of check slip reading.
For details, see "BiMICRRetransmissionCheckData" on page 89.

Syntax
ErrorCode MICRRetransmitionCheckData
(out String response, out MICRStatus status, out MICRDetail detail, int timeout)

Parameters
out String response: Reading data
out MICRStatus status: Reading status
out MICRDetail detail:
int timeout:
Reading status detailed information
Timeout time (in ms units)
4
MICRSelectDataHandling
Configures the operation of check slip reading.
For details, see "BiMICRSelectDataHandling" on page 91.

Syntax
ErrorCode MICRSelectDataHandling
(CharSelect charSel, DetailSelect detailSel, ErrorSelect errorSel)

Parameters
CharSelect charSel: How to handle characters that cannot be analyzedConstants defined in
com.epson.pos.driver.CharSelect shall be used for the value.
DetailSelect detailSel: Availability of detailed information at the time of abnormal termination of reading
Constants defined in com.epson.pos.driver.DetailSelect shall be used for the value.
ErrorSelect errorSel: Whether or not to end the MICR function at the time of abnormal termination.
Regardless of this parameter setting, the MICR function shall continue at the time of
normal termination or at the time of abnormal termination adding reading results.
Constants defined in com.epson.pos.driver.ErrorSelect shall be used for the value.

113
Chapter 4 Reference for .NET

MICRSetReadBack
Starts MICR data reception notification through MICRReadCallback/MICRReadCallbackEx events.
For details, see "BiMICRSetReadBackFunction" on page 93, "BiMICRSetReadBackFunctionEX" on page 94.

Syntax
ErrorCode MICRSetReadBack ()

MICRCancelReadBack
Stops MICR data reception notification through MICRReadCallback/MICRReadCallbackEx events.
For details, see "BiMICRCancelReadBack" on page 97.

Syntax
ErrorCode MICRCancelReadBack ()

114
Chapter 4 Reference for .NET

Events

StatusCallback
Event that handles ASB status notification.
For details, see "BiSetStatusBackFunction" on page 53.

Syntax
StatusCallbackHandler (ASB asb)

Parameters
ASB asb: ASB status. For details, see “Printer Specification”.

StatusCallbackEx
Event that handles ASB status notification. For details, see "BiSetStatusBackFunctionEx" on page 54.

Syntax
StatusCallbackHandlerEx (ASB asb, String portName)

Parameters
ASB asb: ASB status. For details, see “Printer Specification”.
4
String portName: Port name

BatteryStatusCallbackEx
Event that handles power status notification. For details, see "BiSetBatteryStatusBackFunctionEx" on page 64.

Syntax
BatteryStatusCallbackHandlerEx (byte bPowerStatus, byte bBatteryStatus,
String lpcPortName)

Parameters
bPowerStatus: Power status
bBatteryStatus: Battery status
portName: Port name

115
Chapter 4 Reference for .NET

InkStatusCallback
Event that handles ink status notification. For details, see "BiSetInkStatusBackFunction" on page 59.

Syntax
InkStatusCallback (InkASB ink)

Parameters
InkASB ink: Ink status. For details, see “Printer Specification”.

InkStatusCallbackEx
Event that handles ink status notification. For details, see "BiSetInkStatusBackFunctionEx" on page 60.

Syntax
InkStatusCallbackEx (InkASB ink, String portName)

Parameters
InkASB ink: Ink status. For details, see “Printer Specification”.
String portName: Port name

MICRReadCallback
4
Event that handles MICR data notification.
For details, see "BiMICRSetReadBackFunction" on page 93.

Syntax
MICRReadCallbackHandler (String data, MICRStatus status, MICRDetail detail)

Parameters
String data: MICR data
MICRStatus status: Reading status. Constants defined in com.epson.pos.driver.MICRStatus shall be used for
the value.
MICRDetail detail: Reading status detailed information Constants defined in
com.epson.pos.driver.MICRDetail shall be used for the value.

116
Chapter 4 Reference for .NET

MICRReadCallbackEx
Event that handles MICR data notification.

Syntax
MICRReadCallbackHandlerEx
(String data, MICRStatus status, MICRDetail detail, String portName)

Parameters
String data: MICR data
MICRStatus status: Reading status Constants defined in com.epson.pos.driver.MICRStatus shall be used for
the value.
MICRDetail detail: Reading status detailed information Constants defined in
com.epson.pos.driver.MICRDetail shall be used for the value.
String portName: Port name

117

You might also like