Appendix
Describes information of TM-T81 acquired by Status API.
M00003811 Rev.L
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 permission of Seiko Epson Corporation. The contents of this document are subject to change without notice. Please contact us for the latest information. While every precaution has 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 parties 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 Corporations 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 and ESC/POS are registered trademarks of Seiko Epson Corporation in the U.S. and other countries. MS-DOS, Microsoft, Win32, Windows, Windows Vista, Windows Server, Visual Studio , Visual Basic, Visual C++, and Visual C# are either registered trademarks or trademarks of Microsoft Corporation in the United States and other countries.
For Safety
Key to Symbols
Thesymbolsinthismanualareidentifiedbytheirlevelofimportance,asdefinedbelow.Read thefollowingcarefullybeforehandlingtheproduct.
Provides information that must be observed to avoid damage to your equipment or a malfunction. Provides important information and useful tips.
Restriction of Use
Whenthisproductisusedforapplicationsrequiringhighreliability/safetysuchas transportationdevicesrelatedtoaviation,rail,marine,automotiveetc.;disasterprevention devices;varioussafetydevicesetc;orfunctional/precisiondevicesetc,youshouldusethis productonlyaftergivingconsiderationtoincludingfailsafesandredundanciesintoyour designtomaintainsafetyandtotalsystemreliability.Becausethisproductwasnotintendedfor useinapplicationsrequiringextremelyhighreliability/safetysuchasaerospaceequipment, maincommunicationequipment,nuclearpowercontrolequipment,ormedicalequipment relatedtodirectmedicalcareetc,pleasemakeyourownjudgmentonthisproductssuitability afterafullevaluation.
Manual Content
Themanualismadeupofthefollowingsections: Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Appendix Overview Using Status API Reference for Win32 Reference for .NET Generating Log Files Model Information
Contents
For Safety...............................................................................................................................3
Key to Symbols ....................................................................................................................................... 3
Contents ................................................................................................................................5
Overview ........................................................................................9
Manual organization ............................................................................................................................. 9
Methods...............................................................................................................................79
OpenMonPrinter .................................................................................................................................. 79 CloseMonPrinter................................................................................................................................... 79 LockPrinter ............................................................................................................................................ 80 UnlockPrinter......................................................................................................................................... 80 SetMonInterval ..................................................................................................................................... 81 SetMonEtherInterval ..............................................................................................................................81 DirectIOEx ............................................................................................................................................. 82 ResetPrinter........................................................................................................................................... 83 ForceResetPrinter ................................................................................................................................. 83 CancelError........................................................................................................................................... 83 GetType ................................................................................................................................................ 84 GetRealStatus ...................................................................................................................................... 84 SetStatusBack....................................................................................................................................... 85 CancelStatusBack ............................................................................................................................... 85 PowerOff ............................................................................................................................................... 85 GetCounter .......................................................................................................................................... 86 ResetCounter ....................................................................................................................................... 87 GetPrnCapability................................................................................................................................. 87 OpenDrawer ........................................................................................................................................ 88 SendDataFile ........................................................................................................................................ 88 DirectSendRead .................................................................................................................................. 89 SetDefaultEchoTime ............................................................................................................................ 90 SetEtherEchoTime ................................................................................................................................ 90
Events...................................................................................................................................91
StatusCallback ..................................................................................................................................... 91 StatusCallbackEx ................................................................................................................................. 91
Appendix ......................................................................................97
Model Information.............................................................................................................. 97
TM-T81 ....................................................................................................................................................97
Chapter 1 Overview
Overview
StatusAPIisastatusmonitorAPIforEpsonsTMprinters.Advancedfunctionsformonitoring TMprinterscanbeembeddedinapplicationswithprintfunctions.
Manual organization
Install Manual
DescriptionsoftheproceduresfrominstallingtheAPDtoperformingtestprint,addingprinter drivers,andthesilentinstallwhichisanautomatedAPDinstallation.
TM Printer Manual
DescriptionsofhowtousetheAPDanditsfunctions. Descriptionsofthespecifications.
StatusAPI
Printer
In Terminal Service / Citrix XenApp environment, Status API cannot be used.
Glossary
Term
APD
Explanation
Advanced Printer Driver: Windows printer driver for TM printers. Unlike general Windows printer drivers, Status API is simultaneously installed to monitor the printer 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.). TM printer internal counter recording the operating status of the printer, i.e. operating count of the auto cutter, printer running time, etc.
ASB Status
Maintenance Counter
10
Chapter 1 Overview
Explanation
Information required for the print application, i.e. print completed, offline, out of paper, cover open, power off, error generated, etc. This information is automatically sent to the Status API. Acquires information, i.e number of feed paper lines, operating count of the auto cutter, running time, etc. This is used for printer management applications. There are counters that can be reset from Status API and there are integral counters that cannot be reset.
Maintenance Counter
11
Development Language
Win32
VisualBasic6.0 VisualC++
.NET
VisualBasic.NET VisualC#
.NET Framework Version Conforming to the APD environment. Refer to "Install Manual". If you use Status API .NET Wrapper in Windows XP, install .NET Frame Work 2.0 or later before installing APD.
12
Visual Basic
ThefollowingareexamplesofthedevelopmentenvironmentarchitectureusingVisualBasic.
Copy StatusAPI.bas in the folder where the sample program is installed (default is C:\Program Files\EPSON\EPSON Advanced Printer Driver 4 \Sample\US\Src\VB6\SingleFunction\Program09") and paste it into the operating folder used when developing applications. Start Microsoft Visual Basic and open the project screen. Select [Add a standard module] from [Project] in the menu bar. The add standard module screen appears. Select the [Existing file] tab and specify "StatusAPI.bas" copied from the sample program in Procedure 1. Click the [Open] button. "StatusAPI.bas" is added the project explorer. Select [Reference settings] from [Project] in the menu bar. The reference settings screen appears. Place a check by "Microsoft DAO 3.6 Object Library" from the [Reference library file] and click the [OK].
2 3 4
5 6
13
Visual C++
ThefollowingareexamplesofthedevelopmentenvironmentarchitectureusingC++.
1 2 3
Start Microsoft Visual C++ and open the project screen. Copy EpsStmApi.h from the folder installed with APD and paste the file into the operating folder used when developing applications (folder created by the project). Open the Source File. Define EpsStmApi.h using the #include directive.
Definition Methods: #include "EpsStmApi.h"
14
1 2
Start Microsoft Visual Studio 2005 and open the Visual Basic .NET project screen. 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 4 5
The Add References screen appears. Click the [Browse] tab. Specify "C:\WINDOWS\assembly" in [Look in]. Type the file name following the naming rule shown below, and click [OK]. "GAC_MSIL\EpsonStatusAPI\(version of EpsonStatusAPI)_(Public Key Token of EpsonStatusAPI)\EpsonStatusAPI.dll"
Example: GAC_MSIL\EpsonStatusAPI\4.0.9.0__46bb02e1480038cb\EpsonStatusAPI.dll
6 7 8
Select [References] - [EpsonStatusAPI] in Solution Explorer, and select False for [Specific Version] in Properties. Using the Imports statement at the very start of the source code, describe as follows.
Imports com.epson.pos.driver
The Visual Basic .NET environment is ready for developing an application using Status API.
15
Visual C#
ThefollowingisanexampleforcreatingthedevelopmentenvironmentusingVisualC#.
1 2
Start Microsoft Visual Studio 2005 and open the Visual C# project screen. 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 4 5
The Add References screen appears. Click the [Browse] tab. Specify "C:\WINDOWS\assembly" in [Look in]. Type the file name following the naming rule shown below, and click [OK]. "GAC_MSIL\EpsonStatusAPI\(version of EpsonStatusAPI)_(Public Key Token of EpsonStatusAPI)\EpsonStatusAPI.dll"
Example: GAC_MSIL\EpsonStatusAPI\4.0.9.0__46bb02e1480038cb\EpsonStatusAPI.dll
6 7 8
Select [References] - [EpsonStatusAPI] in Solution Explorer, and select False for [Specific Version] in Properties. Using the using keyword at the very start of the source code, describe as follows.
using com.epson.pos.driver
The Visual C# environment is ready for developing an application using Status API.
16
Function
BiOpenMonPrinter BiCloseMonPrinter
Description
Calls the specified printer to use Status API. Closes Status API. Occupies TM printer. Occupies TM printer that is used as a shared pr inter. While occupied, the printer accepts no API from other processes. Cancels BiLockPrinter. Acquires the ASB status from Status API when required by the application. Provides notification regarding the call of the callback function notifying the application when the ASB status of Status API changes.
BiSetStatusBackFunction
Provides notification regarding the call of the callback function notifying the BiSetStatusBackFunctionEx application when the ASB status of Status API changes. Also acquires the port number. BiSetStatusBackWnd Generates a button click event when the ASB status of Status API changes. Cancels the auto status notification function. This function is applicable to BiSetStatusBackFunction, BiSetStatusBackFunctionEx, and BiSetStatusBackWnd. Acquires the maintenance counter value of the printer. Resets the maintenance counter of the printer. Acquires the TM printer information, such as presence of BM sensor and customer display connection. Acquires printer information, i.e. firmware, etc. Opens the drawer.
BiCancelStatusBack
BiGetType
17
Application
Function
Description
After the cause of the error, i.e. paper jam, etc., is 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 printer's power off and on. Resets the parallel, USB, and ethernet I/F printers. Cannot reset serial I/F printers. Can reset also the TM printers occupied with BiLockPrinter. The printer perform as follows. Stores the maintenance counter value.
BiCancelError
BiPowerOff
Places the interface in BUSY state. Places the TM printer in standby mode with power off.
Defines the command definition file created separately to the printer. The command is not executed. S e n d s t h e c o m m a n d o f t h e d e fi n e d command definition file to the printer and executes the command. Can transmit ESC/POS commands to the printer and receive data from the printer. Can send and receive the ESC/POS commands. Does not add the ASB suppress command.
18
Acquires when required by the application BiGetStatus BiSetStatusBackFunction The ASB status is acquired as follows BiSetStatusBackFunctionEx BiSetStatusBackWnd
TheASBstatusisacquiredasfollows. Confirmswhethertheprintercanprintinadvance. Confirms that printing has completed successfully. Confirms with ASB_PRINT_SUCCESS (constant)ofthemacrodefinition. ASB status monitors the main printer conditions, i.e. outofpaper, cover open, printer connectionstatus,etc.Therefore,itisrecommendedthattheprinteriscontinuallymonitored, evenwhennotprinting. RefertoASBStatusonpage23regardingacquiredASBstatus.
Status API has to be started using BiOpenMonPrinter and the printer needs to be opened when acquiring ASB status.
19
BiGetStatus
BiGetStatusacquiresASBstatuswhenrequiredbytheuser(orapplication). Example:ThefollowingdiagramexplainstheflowofStatusAPIandASBstatususing BiGetStatus.
Application Status API Cover open 2 2 Ready to print 3 2 2 Cover open Ready to print 2 2 Ready to print Ready to print Cover open Cover open Ready to print Ready to print 1 Printer
Cover open
[1]Theprinterautomaticallysendsthe ASBstatustoStatusAPIusingtheASB functioneachtimethestatuschanges. StatusAPIstoresthemostrecentASB status. [2]TheapplicationcallsBiGetStatuswhen requiredbyASBstatus.StatusAPI sendsthestoredASBstatustothe application. [3]StatusAPIdoesnotsendtheASB statuseveniftheASBstatusofthe printerchangeswhenthereisno requestfromtheapplication.
No paper
No paper
RefertoBiGetStatusonpage50regardingthesyntaxofBiGetStatus.
20
BiSetStatusBackFunction
BiSetStatusBackFunctionisanAPIthatautomaticallyallowstheapplicationtoacquirethemost recentASBstatusbyusingthecallbackfunction. CallingBiCancelStatusBackcancelstheASBstatusnotificationfromStatusAPIusingthe callbackfunction.RefertoBiCancelStatusBackonpage57fordetails.
This is unavailable when the development environment is Visual Basic.
BiSetStatusBackFunctionEx can recognize from which printer the callback is, in addition to the function of BiSetStatusBackFunction.
Example:ThefollowingdiagramexplainstheflowofStatusAPIandASBstatususing BiSetStatusBackFunction.
Application 2 Cover open Ready to print 2 3 3 No paper Cover open No paper Cover open 3 Ready to print Ready to print No paper Cover open Status API Cover open Printer
Cover open
[1]Theprinterautomaticallysends theASBstatustoStatusAPIusing theASBfunctioneachtimethestatus changes. [2]BiSetStatusBuckFunctionregisters thecallbackfunction. [3]StatusAPIcallsthecallbackfunction andnotifiestheapplicationofthemost recentASBstatuseachtimetheASB statusoftheprinterchanges.
Ready to print
Ready to print
Ready to print
RefertoBiSetStatusBackFunctiononpage52regardingthesyntaxofBiSetStatusBackFunction.
21
BiSetStatusBackWnd
BiSetStatusBackWndisanAPIthatacquiresthemostrecentASBstatusbyregisteringthe windowhandleoftheapplicationscreenbuttonandmemoryaddressstoringthestatus. CallingBiCancelStatusBackcancelstheASBstatusnotificationfromStatusAPIusingthebutton clickevent.RefertoBiCancelStatusBackonpage57fordetails. Example:ThefollowingdiagramexplainstheflowofStatusAPIandASBstatususing BiSetStatusBackWnd. [1]Theprinterautomaticallysendsthe ASBstatustoStatusAPIusingtheASB Status Application Printer 1 API functioneachtimethestatuschanges. 2 Memory StatusAPIstoresthemostrecentASB Cover Cover Event Cover open open status. open [2]WhenBiSetStatusBackWndregisters Event 3 Ready Ready Ready thewindowhandleoftheapplication to print to print to print 3 screenbuttonandmemoryaddress Event storing thestatus,StatusAPIsetsthe No No No paper paper paper datatothespecifiedaddressandsends 3 abuttonclickevent. Event Cover Cover Cover open open [3]StatusAPIsetsthemostrecentASB open 3 statusoftheprintertothespecified Event Ready Ready memoryandsendsabuttonclickevent Ready to print to print to print eachtimetheASBstatusoftheprinter changes. RefertoBiSetStatusBackWndonpage56regardingthesyntaxofBiSetStatusBackWnd.
22
ASB Status
ThefollowingareerrorsreturnedwhenASBstatusisacquired.Thedetailsdifferaccordingto theprintermodel.RefertoModelInformationonpage97fordetails.
Macro Definition (Constant) Cause
The power to the printer is not turned ON. ASB_NO_RESPONSE The communication cable is not Confirm the status and ports of the connected. printer, i.e. cables, etc. The specified printer name/port is different. ASB_PRINT_SUCCESS N o t i fi e s t h a t p r i n t i n g h a s completed successfully. There is nothing else that is notified. The drawer is open. There is no problem if the drawer has been left open intentionally.
Response
An error causing the printer to go Eliminate the cause of the printer to offline was generated. go offline. The cover is open. Paper is being fed. Close the printer's cover. There is no problem if the paper is being fed.
ASB_AUTOCUTTER_ERR
Eliminate the cause of the error and A n a u t o c u t t e r e r r o r wa s restart the printer or send an error generated. recovery command(BiCancelError).* A print error was generated to Immediately turn off the power to the printer. the printer.*
ASB_UNRECOVER_ERR
23
Cause
Response
If the temperature of the head The temperature of the head has d e c r e a s e s w i t h t i m e , t h e e r ro r increased. automatically cancels.* There is only a limited amount of Place paper in the printer. paper remaining. No paper. Place paper in the printer.
ASB_RECEIPT_NEAR_END ASB_RECEIPT_END
The macro definition is defined using the EPSStmApi.h or StatusAPI.bas file when the development environment is constructed.
24
Cause
The parameters of nType differ.
Response
Specify the correct value.
The specified printer is already As the printer is already opened, use the opened. handle value or specify a different printer. The specified printer driver does not Confirm the name of the printer driver. exist. The specified printer cannot be found. An unspecified printer is connected. There is not enough memory.
ERR_NO_TARGET
ERR_NO_MEMORY ERR_HANDLE
The handle value specified by the Confirm the handle value. printer is incorrect. This is a timeout error. R/W cannot be performed on the printer. If the error is continuously generated, confirm whether the printer is properly connected.
ERR_TIMEOUT
ERR_ACCESS
(The power to the printer is not turned on or the cable is not properly connected, etc.) This is a parameter error. This is an unsupported model.
ERR_PARAM ERR_NOT_SUPPORT
Review the syntax as the specified parameter is incorrect. Unsupported models cannot be used. Delete the already existing data. Example: When this error occurs during executing BiSetStatusBackXXX, retr y it after executing BiCancelStatusBack.
ERR_EXIST
ERR_EXEC_FUNCTION
This function is unavailable as Status C l o s e t h e S t at u s A P I u s e d by o t h e r API is used by other applications. applications. The PortHandler is not running, or a Verify the connection between them, communication error between the then restart the computer. client of PortHandler and the server.
ERR_PH_NOT_EXIST
25
Cause
Response
Confir m whether the Print Spooler is The spooler service is not operating. properly operating. (Control Panel Management Tools - Service) This function is unavailable as the Recall after waiting a moment. printer is being reset. The printer is locked. Wait until the printer becomes unlocked, or execute BiUnlockPrinter in the program that is locking the printer.
ERR_RESET
ERR_LOCKED
The macro definition is defined using the EPSStmApi.h or StatusAPI.bas file when the development environment is constructed.
26
When you use only one API in your application, the exclusive access is not necessary.
27
Program example
int nRet = BiLockPrinter(1, 1000); if (nRet == SUCCESS) { //Locks the printer to allow exclusive access of the following API. Unlocks the printer when finished. BiSCNSetImageFormat(1, EPS_BI_SCN_JPEGNORMAL); BiSCNReadImage(1, 1, EPS_BI_SCN_CHECKPAPER, 0, 0, NULL, EPS_BI_SCN_NVMEMORY_NOTSAVE); //Unlocks the printer BiUnlockPrinter(1); } else { //Error handling in case that the exclusive access is failed. }
28
Page
30 33 36 38 44 47 50 52 56 58 61 65 69 74
Status API
BiCloseMonPrinter BiUnlockPrinter BiSetMonEtherInterval BiDirectIOEx BiForceResetPrinter BiGetType BiGetRealStatus BiSetStatusBackFunctionEx BiCancelStatusBack BiGetCounter BiGetPrnCapability BiSendDataFile BiSetDefaultEchoTime BiSetReadWaitTimeOut
Page
32 35 37 40 46 49 51 54 57 59 63 67 72 75
29
BiOpenMonPrinter
MakesStatusAPIavailablefortheprinterandreturnsthehandle. Youcanopenoneprinterfrommultipleprocessesatthesametime. Whenyouopentheopenedprinterfromthesameprocessagain,anewdifferenthandlewill return.Insuchacase,bothhandlesarevalid.
Syntax
nErr = BiOpenMonPrinter (int nType, LPSTR pName)
Example) MakeStatusAPIavailablefromtheport. nHandle=BiOpenMonPrinter(1,ESDPRT001); MakeStatusAPIavailablefromtheprinter. nHandle=BiOpenMonPrinter(2,EPSONTMT81Receipt);
Argument
nType: SpecifiesthepNametype.ThisisanINTtype.
Value
1 2
Description
Specify the port name in pName. Specify the printer name in pName.
pName:
Return value
Returnsthevariable(nHandle)definedinINTtype.IfStatusAPIissuccessfullyused,thehandle identifyingtheprinterisreturnedtonHandle(correctvalue).Thehandleisreturnedevenifthe printerisoffline. ThefollowingStatusAPIexecutionerrors(value)arereturned.
Macro Definition (Constant)
ERR_TYPE ERR_OPENED ERR_NO_PRINTER ERR_NO_TARGET ERR_NO_MEMORY ERR_TIMEOUT ERR_ACCESS
Value
-10 -20 -30 -40 -50 -70 -80 Parameter error of nType
Description
The specified printer is already opened. The specified printer driver does not exist Printer unavailable Not enough memory Timeout error R/W cannot be performed on the printer
30
Value
-90 -340 -350 Parameter error
Description
The PortHandler is not running or a communication error between the client of PortHandler and the server. The spooler service is not operating.
For information on remedies for the Status API execution errors, refer to "Status API Execution Error" on page 25.
Comment
CallthisfunctionbeforeusingotherStatusAPIfunctions.Thehandleofthereturnvalueisused astheargumentbyotherStatusAPIfunctions.
When this function is called, the specified printer is exclusively available until BiCloseMonPrinter is called. Status API functions from other applications are unavailable during this time. Acquired handles are only valid within the same application. The maximum number of printers that can be started at one time is 32.
Thefollowingoperationsareexecutedaccordingtotheprinterstatuswhenthisfunctionis called.
Printer Status
Online Offline Cable Removed/Power Off
Operation
Returns the handle to nHandle. Returns the handle to nHandle. However, switch to online as the printer cannot print offline. Returns "ERR_ACCESS" to nHandle.
31
BiCloseMonPrinter
Cancelsthestatusmonitoringprinter.
When a BiOpenMonPrinter function is called, always cancel the status monitoring printer using the BiCloseMonPrinter function. An error is generated if a BiOpenMonPrinter function is called again without canceling.
Syntax
nErr = BiCloseMonPrinter (nHandle)
Argument
nHandle: Specifiesthehandle.ThisisanINTtype.
Return value
ReturnsthefollowingStatusAPIexecutionerrors(value)tothevariable(nErr)definedbythe INTtype.ReturnsSUCCESS(macrodefinition)whenthisfunctionissuccessfullycalled.
Macro Definition (Constant)
SUCCESS ERR_HANDLE ERR_PH_NOT_EXIST
Value
0 -60 -340 Success
Description
Specified handle is invalid 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 25.
32
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
nErr = BiLockPrinter (nHandle, timeout)
Argument
nHandle: Specifiesthehandle.ThisisanINTtype. timeout: Specifiesthetimeouttimeinms(milliseconds).Specifyitwithapositivevalue.This isaDWORDtype.
Return value
ReturnsthefollowingStatusAPIexecutionerrors(value)tothevariable(nErr)definedbythe INTtype.ReturnsSUCCESS(macrodefinition)whenthisfunctionissuccessfullycalled.
Macro Definition (Constant)
SUCCESS ERR_HANDLE ERR_EXEC_FUNCTION ERR_PH_NOT_EXIST ERR_RESET ERR_LOCKED
Value
0 -60 -310 -340 -400 -1000 Success
Description
Specified handle is invalid This function is unavailable as Status API is used by other applications. The PortHandler is not running or a communication error between the client of PortHandler and the server. Cannot call as the printer is restarting The printer is locked.
For information on remedies for the Status API execution errors, refer to "Status API Execution Error" on page 25.
33
Comment
ThisAPIallowsyoutoaccesstheTMprinterexclusively.TheBiUnlockPrinterAPIisprovided forcancelingtheexclusiveaccess.WhiletheTMprinterisexclusivelyaccessed,theprinterdoes notacceptanyotherAPIrequestsofdirectaccesstotheprinter.Theprinterwillreturn ERR_LOCKEDtothoseotherAPIrequests. TheexclusiveaccessrighttotheTMprinterisgiventoaprocess.Therefore,theexclusiveAPI accessisavailablefromotherthreadsinthesameprocessthatislockingtheprinter. ExecutingofAPIinthesameprocesscanberepeated.Inthiscase,theprinterislockedwith multipleaccesses.Tounlocktheprinter,executeBiUnlockPrinterthenumberoftimestheAPI hasbeenexecuted. Whenexecutingexclusiveaccessfromaclienttoasharedprinterortoalocalprintervia Ethernet,theaccessstatusisinterruptediftheconnectionislost,andrestoreduponrecoveryof theconnection. However,whiletheexclusiveaccessstatusisbeinginterrupted,anotherprocesscanlocktheTM printerforexclusiveaccess.Oncetheprinterislockedbyanotherprocess,theprinterreturns ERR_LOCKEDtoAPIofthepreviousprocess.Whenanotherprocessisfinishedunlockingthe printer,theexclusiveaccessstatusofthepreviousprocessisrestored. Possiblecausesoftheconnectionfailureareasfollows. [FailureduringexclusiveaccesstoaprinterconnectedviaEthernet] The printer is turned Off, or the Ethernet connection between the computer and the printerisdisconnected. ThecomputerhasenteredStandbyorHibernatemode. [Failureduringexclusiveaccesstoasharedprinterfromaclient] Theconnectionbetweentheclientandtheserverisdisconnected. TheclientcomputerhasenteredStandbyorHibernatemode.
34
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
nErr = BiUnlockPrinter (nHandle)
Argument
nHandle: Specifiesthehandle.ThisisanINTtype.
Return value
ReturnsthefollowingStatusAPIexecutionerrors(value)tothevariable(nErr)definedbythe INTtype.ReturnsSUCCESS(macrodefinition)whenthisfunctionissuccessfullycalled.
Macro Definition (Constant)
SUCCESS ERR_HANDLE ERR_EXEC_FUNCTION ERR_PH_NOT_EXIST ERR_RESET ERR_LOCKED
Value
0 -60 -310 -340 -400 -1000 Success
Description
Specified handle is invalid This function is unavailable as Status API is used by other applications. The PortHandler is not running or a communication error between the client of PortHandler and the server. Cannot call as the printer is restarting The printer is locked.
For information on remedies for the Status API execution errors, refer to "Status API Execution Error" on page 25.
Comment
ThisAPIunlockstheprinterlockedbyBiLockPrinter.Afterthelockiscanceled,theprinter canaccepttheAPIfromotherprocesses. IfyouexecutethisAPIwhentheprinterisnotlocked,SUCCESSwillbereturnedtoReturn value.
35
BiSetMonInterval
Configures the time interval for Status API to read printer status.
Setting the interval to a long time overflows the serial receiving buffer and an accurate ASB status cannot be acquired.
Syntax
nErr = BiSetMonInterval (nHandle, wNoPrnInterval, wPrnInterval)
Argument
nHandle: wNoPrnInterval: wPrnInterval: Specifiesthehandle.ThisisanINTtype. Notused. SpecifiestheintervaltomonitorthestatusofStatusAPIinmilliseconds. ThisisaWORDtype.
Return value
ReturnsthefollowingStatusAPIexecutionerrors(value)tothevariable(nErr)definedbythe INTtype.ReturnsSUCCESS(macrodefinition)whenthisfunctionissuccessfullycalled.
Macro Definition (Constant)
SUCCESS ERR_HANDLE ERR_PARAM ERR_EXEC_FUNCTION ERR_PH_NOT_EXIST ERR_LOCKED
Value
0 -60 -90 -310 -340 -1000 Success
Description
Specified handle is invalid Parameter error This function is unavailable as Status API is used by other applications. The PortHandler is not running or a communication error between the client of PortHandler and the server. The printer is locked.
For information on remedies for the Status API execution errors, refer to "Status API Execution Error" on page 25.
Comment
Thedefaultvalueis100millisecondsiftheintervaltomonitorthestatusofStatusAPIisnot specifiedbythisAPI.
For interfaces supporting Ethernet, this is done by BiSetMonEtherInterval. See "BiSetMonEtherInterval" on page 37. Before execute this API, execute BiUnlockPrinter.
36
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 36.
Syntax
nErr = BiSetMonEtherInterval (nHandle, wEtherInterval)
Argument
nHandle: wEtherInterval: Specifiesthehandle.ThisisanINTtype. SpecifiestheintervaltomonitorthestatusofStatusAPI(1to65)insecond. ThisisaWORDtype.Evenifthevaluemorethan65secondsisconfigured, 65secondswillbeactuallyconfigured.
Return value
ReturnsthefollowingStatusAPIexecutionerrors(value)tothevariable(nErr)definedbythe INTtype.ReturnsSUCCESS(macrodefinition)whenthisfunctionissuccessfullycalled.
Macro Definition (Constant)
SUCCESS ERR_HANDLE ERR_ACCESS ERR_PARAM ERR_NOT_SUPPORT ERR_EXEC_FUNCTION ERR_PH_NOT_EXIST ERR_LOCKED
Value
0 -60 -80 -90 -100 -310 -340 -1000 Success
Description
Specified handle is invalid R/W cannot be performed on the printer Parameter error Not supported This function is unavailable as Status API is used by other applications. The PortHandler is not running or a communication error between the client of PortHandler and the server. The printer is locked.
For information on remedies for the Status API execution errors, refer to "Status API Execution Error" on page 25.
Comment
Thedefaultvalueis3secondsiftheintervaltomonitorthestatusofStatusAPIisnotspecified bythisAPI.
Before execute this API, execute BiUnlockPrinter.
37
BiDirectIO
Sendsspecialcommands(ESC/POScommand)totheprinter.Canalsoacquirecommand executionresultsfromtheprinter.ItisrecommendedthatBiDirectIOExisusedtoacquire executionresults.
Contact the dealer regarding ESC/POS commands.
Syntax
nErr = BiDirectIO (nHandle, writeLen, writeCmd, readLen, readBuff, Timeout, nullTerminate)
Refertothenextargument.
Argument
nHandle: writeLen: Specifiesthehandle.ThisisanINTtype. Specifiesthedatalengthtowritetotheprinter.Doesnotwritetotheprinter when0. ThisisaBYTEtype. Specifiesthedata(ESC/POScommand)towritetotheprinter.ThisisaLPBYTE type. Specifiesthedatalengthreadfromtheprinter. Specifywhenthecommandexecutionresultsarerequiredfromtheprinter. Specifyas0whennotrequired.ThisisaLPBYTEtype. Specifiesthebuffersavingthedatareadfromtheprinter. ThisisaLPBYTEtype. Specifiesthetimeouttimeinms(milliseconds).ThisisaDWORDtype.
writeCmd: readLen:
readBuff: Timeout:
38
Return value
ReturnsthefollowingStatusAPIexecutionerrors(value)tothevariable(nErr)definedbythe INTtype.ReturnsSUCCESS(macrodefinition)whenthisfunctionissuccessfullycalled.
Macro Definition (Constant)
SUCCESS ERR_HANDLE ERR_TIMEOUT ERR_ACCESS ERR_PARAM ERR_BUFFER_OVER_FL OW ERR_EXEC_FUNCTION ERR_PH_NOT_EXIST ERR_RESET ERR_LOCKED
Value
0 -60 -70 -80 -90 -140 -310 -340 -400 -1000 Success
Description
Specified handle is invalid Timeout error R/W cannot be performed on the printer Parameter error Lack of buffer capacity. This function is unavailable as Status API is used by other applications. The PortHandler is not running or a communication error between the client of PortHandler and the server. Cannot call as the printer is restarting The printer is locked.
For information on remedies for the Status API execution errors, refer to "Status API Execution Error" on page 25.
Comment
ConfirmproperexecutionofthefunctionbyconfirmingthereturnvalueofnErrorproper commandexecutionbyconfirmingprinteroperation.Ifexecutionresultsareacquiredfromthe printer(specifyreadLen),confirmtheexecutionresults. Thefollowingoperationsareexecutedaccordingtotheprinterstatuswhenthisfunctionis called.
Printer Status
Online Offline Returns "SUCCESS" to nErr. Executes the command. Returns SUCCESS when communication with the printer completed successfully 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 Printing Returns "ERR_ACCESS" to nErr. Returns "ERR_LOCKED" to nErr.
Operation
39
BiDirectIOEx
Sendsspecialcommands(ESC/POScommand)totheprinter.Canalsoacquirecommand executionresultsfromtheprinter.TheASBsuppresscommandcanbeaddedfordifferences withBiDirectIO.WhentheASBsuppresscommandisadded,separatedata(ASBstatus,etc.)is notsentfromtheprinteruntilthisfunctioniscomplete,therefore,thisisrecommendedwhen receivingexecutionresultsfromtheprinter.
When considering expandability and versatility, it is recommended to use BiDirectIOEx rather than using the BiDirectIO function. Contact the dealer regarding ESC/POS commands.
Syntax
nErr = BiDirectIOEx (nHandle, writeLen, writeCmd, readLen, readBuff, Timeout, nullTerminate, option )
Refertothenextargument.
Argument
nHandle: writeLen: writeCmd: readLen: Specifiesthehandle.ThisisanINTtype. Specifiesthedatalengthtowritetotheprinter.Doesnotwritetotheprinter when0.ThisisaDWORDtype. Specifiesthedata(ESC/POScommand)towritetotheprinter.ThisisaLPBYTE type. Specifiesthedatalengthreadfromtheprinter. Specifywhenthecommandexecutionresultsarerequiredfromtheprinter. Specifyas0whennotrequired.ThisisaLPDWORDtype. Specifiesthebuffersavingthedatareadfromtheprinter. ThisisaLPBYTEtype. Specifiesthetimeouttimeinms(milliseconds).ThisisaDWORDtype.
readBuff: Timeout:
40
option:
ControlstheASBsuppressioncommand.ThisisaBYTEtype.
Value
0 1
Description
Send an ASB suppression command before writing data and enable ASB after reading the data. Does not send the ASB suppression command or ASB enable command.
Ensure that the size of readBuff is the same length specified in readLen or longer.
Return value
ReturnsthefollowingStatusAPIexecutionerrors(value)tothevariable(nErr)definedbythe INTtype.ReturnsSUCCESS(macrodefinition)whenthisfunctionissuccessfullycalled.
Macro Definition (Constant)
SUCCESS ERR_NO_MEMORY ERR_HANDLE ERR_TIMEOUT ERR_ACCESS ERR_PARAM ERR_BUFFER_OVER_FL OW ERR_EXEC_FUNCTION ERR_PH_NOT_EXIST ERR_RESET ERR_LOCKED
Value
0 -50 -60 -70 -80 -90 -140 -310 -340 -400 -1000 Success Not enough memory Specified handle is invalid Timeout error
Description
R/W cannot be performed on the printer Parameter error Lack of buffer capacity. This function is unavailable as Status API is used by other applications. The PortHandler is not running or a communication error between the client of PortHandler and the server. Cannot call as the printer is restarting The printer is locked.
For information on remedies for the Status API execution errors, refer to "Status API Execution Error" on page 25.
41
Comment
ConfirmproperexecutionofthefunctionbyconfirmingthereturnvalueofnErrorproper commandexecutionbyconfirmingprinteroperation.Ifexecutionresultsareacquiredfromthe printer(specifyreadLen),confirmtheexecutionresults. Thefollowingoperationsareexecutedaccordingtotheprinterstatuswhenthisfunctionis called.
Printer Status
Online Offline Returns "SUCCESS" to nErr. Executes the command. Returns SUCCESS when communication with the printer completed successfully 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 Printing Returns "ERR_ACCESS" to nErr. Returns "ERR_LOCKED" to nErr.
Operation
Caution
Although the maximum data length that can be specified for Read/Write is 2GB, specify the requiredminimumdatalength. DonotsendinvalidcommandsofASBstatustransmissionsusingthisfunctionwhilemonitor ingthestatusoftheprinter.Subsequentstatuscannotbeacquired. The ASB (automatic status notification) suppression command ensures that unintended data isnotreceivedwhensendingcommandsrequestingaresponsefromtheprinter. Ifyou donot use theASBsuppression,ensurethatthe programmingconsidersthereception ofunintendeddata.
42
Specifyingthereceivingbufferprocessesthedatareceivedfromtheprinterusingthisfunction or processes the data using the same process as the monitoring sled (BiGetStatus function, etc.).Refertothefollowing.
Transmission Command
Acquiring status command No
Receiving Buffer
Saves the ASB status to the receiving buffer -
Presenter Command
Yes
Saves the presenter response to the receiving buffer Enters the printer response into the receiving buffer Generates timeout error -
Calls back the presenter Does not effect the monitoring sled Abnormal callbacks may be generated Does not effect the monitoring sled Does not effect the monitoring sled
43
BiResetPrinter
Resetsstatusmonitoringprinters.
Cancels print jobs when this is called while printing. The TM printer with the serial interface cannot be reset.
Syntax
nErr = BiResetPrinter (nHandle)
SpecifythehandleinnHandle.
Argument
nHandle: Specifiesthehandle.ThisisanINTtype.
Return value
ReturnsthefollowingStatusAPIexecutionerrors(value)tothevariable(nErr)definedbythe INTtype.ReturnsSUCCESS(macrodefinition)whenthisfunctionissuccessfullycalled.
Macro Definition (Constant)
SUCCESS ERR_HANDLE ERR_NOT_SUPPORT ERR_EXEC_FUNCTION ERR_PH_NOT_EXIST ERR_RESET ERR_LOCKED
Value
0 -60 -100 -310 -340 -400 -1000 Success
Description
Specified handle is invalid Not supported Cannot call as another Status API is in use The PortHandler is not running or a communication error between the client of PortHandler and the server. Cannot call as the printer is restarting The printer is locked.
For information on remedies for the Status API execution errors, refer to "Status API Execution Error" on page 25.
44
Comment
ConfirmproperexecutionofthefunctionbyconfirmingthereturnvalueofnErrorbyresetting theprinterandconfirmingthattheprinterisonline(confirmingtheASBstatus).
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.
Thefollowingoperationsareexecutedaccordingtotheprinterstatuswhenthisfunctionis called.
Printer Status
Online Offline Cable R e m ove d / Power Off Printing
Operation
Returns "SUCCESS" to nErr and resets. Returns "SUCCESS" to nErr and resets. Returns "ASB_NO_RESPONSE" to ASB status and does not reset. Cancels the print job and resets.
45
BiForceResetPrinter
ForcestoresettheTMprinterwhosestatusisbeingmonitored. TheTMprintercanbereseteveninmultithread/process/userenvironments. TheTMprintercanberesetevenifBiLockPrinterisaccessedbyadifferentprogram. Iftheconnectiontoanetworkprinterislostandthenreestablished,sometimewillberequired beforeprintingispossibleagain.UseofthisAPIallowsthattimetobeshortened.
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
nErr = BiForceResetPrinter (nHandle)
SpecifythehandleinnHandle.
Argument
nHandle: Specifiesthehandle.ThisisanINTtype.
Return value
ReturnsthefollowingStatusAPIexecutionerrors(value)tothevariable(nErr)definedbythe INTtype.ReturnsSUCCESS(macrodefinition)whenthisfunctionissuccessfullycalled.
Macro Definition (Constant)
SUCCESS ERR_HANDLE ERR_ACCESS ERR_NOT_SUPPORT ERR_EXEC_FUNCTION ERR_PH_NOT_EXIST
Value
0 -60 -80 -100 -310 -340 Success
Description
Specified handle is invalid R/W cannot be performed on the printer Not supported Cannot call as another Status API is in use 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 25.
46
BiCancelError
Ifaprinterrecoverableerrorisgenerated,executethisfunctionafterremovingtheerrorcause, andtheTMprinterrecoversfromtheerror.
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
nErr = BiCancelError (nHandle)
SpecifythehandleinnHandle.
Argument
nHandle: Specifiesthehandle.ThisisanINTtype.
Return value
ReturnsthefollowingStatusAPIexecutionerrors(value)tothevariable(nErr)definedbythe INTtype.ReturnsSUCCESS(macrodefinition)whenthisfunctionissuccessfullycalled.
Macro Definition (Constant)
SUCCESS ERR_HANDLE ERR_ACCESS ERR_NOT_SUPPORT ERR_EXEC_FUNCTION ERR_PH_NOT_EXIST ERR_RESET ERR_LOCKED
Value
0 -60 -80 -100 -310 -340 -400 -1000 Success
Description
Specified handle is invalid R/W cannot be performed on the printer Not supported This function is unavailable as Status API is used by other applications. The PortHandler is not running or a communication error between the client of PortHandler and the server. Cannot call as the printer is restarting The printer is locked.
For information on remedies for the Status API execution errors, refer to "Status API Execution Error" on page 25.
47
Comment
UseBiCancelErrorasfollows.
Error
Cover open error Auto cutter error
Response
Call this function after closing the cover. Call this function after removing any paper around the cutter and closing the cover.
48
BiGetType
AcquiresthetypeIDoftheprinter.
For information on the type ID that can be acquired, ask your dealer.
Syntax
nErr = BiGetType (nHandle, typeID, font, exrom, special)
IfyouspecifyahandletonHandle,atypeIDissettotypeID,Devicefontissetto font.AspecialID oftheprinterreturnstospecial.
Argument
nHandle: typeID: font: exrom: special: Specifiesthehandle.ThisisanINTtype. AtypeIDoftheprinterwillbeset.ThisisaLPBYTEtype. Devicefontwillbeset.ThisisaLPBYTEtype. Thisisnotapplicable.ThisisaLPBYTEtype. AspecialIDoftheprinterwillbeset.ThisisaLPBYTEtype.
Return value
ReturnsthefollowingStatusAPIexecutionerrors(value)tothevariable(nErr)definedbythe INTtype.ReturnsSUCCESS(macrodefinition)whenthisfunctionissuccessfullycalled.
Value
0 -60 -70 -80 -90 -100 -310 -340 -400 -1000 Success
Description
Specified handle is invalid Timeout error R/W cannot be performed on the printer Parameter error Not supported This function is unavailable as Status API is used by other applications. The PortHandler is not running or a communication error between the client of PortHandler and the server. Cannot call as the printer is restarting The printer is locked.
For information on remedies for the Status API execution errors, refer to "Status API Execution Error" on page 25.
49
BiGetStatus
Acquiresthecurrentprinterstatus(ASBstatus).
Syntax
nErr = BiGetStatus (nHandle, lpStatus)
SpecifythehandleinnHandle.ReturnsASBstatustolpStatus.
Argument
nHandle: lpStatus: Specifiesthehandle.ThisisanINTtype. ReturnstheASBstatussavedtoStatusAPI.ThisisaLPDWORDtype. TheASBstatusisa4byteconfiguration.
Return value
ReturnsthefollowingStatusAPIexecutionerrors(value)tothevariable(nErr)definedbythe INTtype.ReturnsSUCCESS(macrodefinition)whenthisfunctionissuccessfullycalled.
Value
0 -60 -90 -310 Success
Description
Specified handle is invalid Parameter error 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 25.
Comment
RefertoModelInformationonpage97regardingtheASBstatusthatcanbeacquiredbyTM T81.
50
BiGetRealStatus
Acquiresthecurrentprinterstatus(ASBstatus).
Syntax
nErr = BiGetRealStatus (nHandle, lpStatus)
Argument
nHandle: lpStatus: Specifiesthehandle.ThisisanINTtype. ReturnstheASBstatussavedtoStatusAPI.ThisisaLPDWORDtype. TheASBstatusisa4byteconfiguration.
Return value
ReturnsthefollowingStatusAPIexecutionerrors(value)tothevariable(nErr)definedbythe INTtype.ReturnsSUCCESS(macrodefinition)whenthisfunctionissuccessfullycalled.
Value
0 -60 -80 -90 -310 -340 -400 -1000 Success
Description
Specified handle is invalid R/W cannot be performed on the printer Parameter error Cannot call as another Status API is in use The PortHandler is not running or a communication error between the client of PortHandler and the server. Cannot call as the printer is restarting The printer is locked.
For information on remedies for the Status API execution errors, refer to "Status API Execution Error" on page 25.
Comment
ThisfunctionsendsthecommandtoacquiretheASBstatustotheprinterandreceivesthe acquiredstatusafterthefunctioniscalled.Thatiswhy,evenwhenprintinghasbeencompleted, ASB_PRINTSUCCESSisnotacquired.Also,whenthepoweristurnedoff,ASB_NO_RESPONSE isnotacquiredbecauseERR_ACCESSisreturned. RefertoModelInformationonpage97regardingtheASBstatusthatcanbeacquiredbyTM T81.
51
BiSetStatusBackFunction
Automaticallyacquirestheprinterstatus(ASBstatus)usingthecallbackfunctionwhenthe printerstatuschanges.
This is unavailable when the development environment is VB.
Syntax
nErr = BiSetStatusBackFunction (nHandle, int (CALLBACK EXPORT *pStatusCB) (DWORD dwStatus))
Argument
nHandle: Specifiesthehandle.ThisisanINTtype. int(CALLBACKEXPORT*pStatusCB)(DWORDdwStatus): Specifiesthedefinitionaddressofthecallbackfunction. dwStatus: ReturnstheASBstatussavedtoStatusAPI.ThisisaDWORDtype. TheASBstatusisa4byteconfiguration.
Return value
ReturnsthefollowingStatusAPIexecutionerrors(value)tothevariable(nErr)definedbythe INTtype.ReturnsSUCCESS(macrodefinition)whenthisfunctionissuccessfullycalled.
Value
0 -60 -90 -210 -310 Success
Description
Specified handle is invalid Parameter error The specified data already exists. 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 25.
52
Comment
CallthisfunctiontosettheprinterstatustodwStatusandcallthecallbackfunction.Whenthe printerstatuschanges,newinformationisautomaticallysettodwStatusandcallsthecallback function.CancelthisfunctionusingBiCancelStatusBack. RefertoModelInformationonpage97regardingtheASBstatusthatcanbeacquiredbyTM T81.
Status API cannot be used within the registered callback function.
53
BiSetStatusBackFunctionEx
Automaticallyacquirestheprinterstatus(ASBstatus)usingthecallbackfunctionwhenthe printerstatuschanges. Identifiestheprinterportoriginatingthecallback,inadditiontothefunctionsof BiSetStatusBackFunction.
This is unavailable when the development environment is VB.
Syntax
nErr = BiSetStatusBackFunctionEx (nHandle, int (CALLBACK EXPORT *pStatusCB) (DWORD dwStatus, LPSTR lpcPortName))
Argument
nHandle: Specifiesthehandle.ThisisanINTtype. int(CALLBACKEXPORT*pStatusCB)(DWORDdwStatus,LPSTRlpcPortName): Specifiesthedefinitionaddressofthecallbackfunction. dwStatus: lpcPortName: ReturnstheASBstatussavedtoStatusAPI.TheASBstatusisa4byte configuration.ThisisaDWORDtype. Returnstheprinterportnameoriginatingthecallback.ThisisaLPSTRtype.
Return value
ReturnsthefollowingStatusAPIexecutionerrors(value)tothevariable(nErr)definedbythe INTtype.ReturnsSUCCESS(macrodefinition)whenthisfunctionissuccessfullycalled.
Value
0 -60 -90 -210 -310 Success
Description
Specified handle is invalid Parameter error The specified data already exists. 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 25.
54
Comment
CallthisfunctiontosettheprinterstatustodwStatusandcallthecallbackfunction.Whenthe printerstatuschanges,newinformationisautomaticallysettodwStatusandcallsthecallback function.CancelthisfunctionusingBiCancelStatusBack. RefertoModelInformationonpage97regardingtheASBstatusthatcanbeacquiredbyTM T81.
Status API cannot be used within the registered callback function.
55
BiSetStatusBackWnd
Automaticallygeneratesaclickeventandacquirestheprinterstatus(ASBstatus)whenthe printerstatuschanges.
Syntax
nErr = BiSetStatusBackWnd (nHandle, hWnd, lpStatus)
SpecifythehandleinnHandle.ReturnsASBstatustolpStatus.
Argument
nHandle: hWnd: lpStatus: Specifiesthehandle.ThisisanINTtype. Specifiesthewindowhandleofthebuttongeneratingtheclickevent. ThisisaLongtype. ReturnstheASBstatussavedtoStatusAPI.ThisisaLPDWORDtype. TheASBstatusisa4byteconfiguration.
Return value
ReturnsthefollowingStatusAPIexecutionerrors(value)tothevariable(nErr)definedbythe INTtype.ReturnsSUCCESS(macrodefinition)whenthisfunctionissuccessfullycalled.
Value
0 -60 -90 -210 -310 Success
Description
Specified handle is invalid Parameter error The specified data already exists. 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 25.
Comment
RefertoModelInformationonpage97regardingtheASBstatusthatcanbeacquiredbyTM T81.
Status API cannot be used from the specified window handle.
56
BiCancelStatusBack
Cancelstheautomaticstatusnotificationrequestprocesscalledusingthe BiSetStatusBackFunction,BiSetStatusBackFunctionEx,orBiSetStatusBackWndfunction.
Syntax
nErr = BiCancelStatusBack (nHandle)
SpecifythehandleinnHandle.
Argument
nHandle: Specifiesthehandle.ThisisanINTtype.
Return value
ReturnsthefollowingStatusAPIexecutionerrors(value)tothevariable(nErr)definedbythe INTtype.ReturnsSUCCESS(macrodefinition)whenthisfunctionissuccessfullycalled.
Value
0 -60 -310 Success
Description
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 Error" on page 25.
57
BiPowerOff
Updatesthemaintenancecounterandpreparestoturnoffthepowertotheprinter. Cannotturnoffthepowertotheprinter.
Cannot call when in online recovery standby.
Syntax
nErr = BiPowerOff (nHandle)
SpecifythehandleinnHandle.
Argument
nHandle: Specifiesthehandle.ThisisanINTtype.
Return value
ReturnsthefollowingStatusAPIexecutionerrors(value)tothevariable(nErr)definedbythe INTtype.ReturnsSUCCESS(macrodefinition)whenthisfunctionissuccessfullycalled.
Value
0 -50 -60 -70 -80 -100 -310 -340 -1000 Success Not enough memory
Description
Specified handle is invalid Timeout error R/W cannot be performed on the printer Not supported Cannot call as another Status API is in use The PortHandler is not running or a communication error between the client of PortHandler and the server. The printer is locked.
For information on remedies for the Status API execution errors, refer to "Status API Execution Error" on page 25.
Comment
TheTMprinterperformasfollows. Storesthemaintenancecountervalue. PlacestheinterfaceinBUSYstate. PlacestheTMprinterinstandbymodewithpoweroff.
58
BiGetCounter
Acquiresthemaintenancecountervalue.
For information on the counter number and the maintenance counters that can be acquired, refer to "Model Information" on page 97. 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
nErr = BiGetCounter (nHandle, readno, readcounter)
SpecifythehandleinnHandle.readnospecifiestheacquiredmaintenancecounternumberand themaintenancecountervalueisreturnedtoreadcounter.
Argument
nHandle: readno: readcounter: Specifiesthehandle.ThisisanINTtype. Specifiestheacquiredmaintenancecounternumber.ThisisaWORDtype. Returnsthemaintenancecounter.ThisisaLPDWORDtype.
Return value
ReturnsthefollowingStatusAPIexecutionerrors(value)tothevariable(nErr)definedbythe INTtype.ReturnsSUCCESS(macrodefinition)whenthisfunctionissuccessfullycalled.
3
Value
0 -60 -70 -80 -90 -100 -310 -340 -400 -1000 Success Specified handle is invalid Timeout error R/W cannot be performed on the printer Parameter error Not supported This function is unavailable as Status API is used by other applications. The PortHandler is not running or a communication error between the client of PortHandler and the server. Cannot call as the printer is restarting The printer is locked.
Description
For information on remedies for the Status API execution errors, refer to "Status API Execution Error" on page 25.
59
Comment
Therearetwotypesofmaintenancecounters;thosethatcanberesetbytheuser,andintegrated countersthatcannotbereset. Thefollowingoperationsareexecutedaccordingtotheprinterstatuswhenthisfunctionis called.
Printer Status
Online Offline Cable Removed/ Power Off Printing
Operation
Returns "SUCCESS" to nErr. Acquires the maintenance counter value. Returns "ERR_TIMEOUT" to nErr. Does not acquire the maintenance counter value. Returns "ERR_ACCESS" to nErr. Does not acquire the maintenance counter value. Returns "ERR_ACCESS" to nErr. Does not acquire the maintenance counter value.
60
BiResetCounter
Resetsthemaintenancecounter.
For information on the counter number and the maintenance counters that can be reset, refer to "Model Information" on page 97. 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
nErr = BiResetCounter (nHandle, readno)
SpecifythehandleinnHandle.Specifythemaintenancecounternumberresettoreadno.
Argument
nHandle: readno: Specifiesthehandle.ThisisanINTtype. Specifiesthemaintenancecounternumbertobereset.ThisisaWORDtype.
Return value
ReturnsthefollowingStatusAPIexecutionerrors(value)tothevariable(nErr)definedbythe INTtype.ReturnsSUCCESS(macrodefinition)whenthisfunctionissuccessfullycalled.
Value
0 -60 -70 -80 -90 -100 -310 -340 -400 -1000 Success
Description
Specified handle is invalid Timeout error R/W cannot be performed on the printer Parameter error Not supported This function is unavailable as Status API is used by other applications. The PortHandler is not running or a communication error between the client of PortHandler and the server. Cannot call as the printer is restarting The printer is locked.
For information on remedies for the Status API execution errors, refer to "Status API Execution Error" on page 25.
61
Comment
IfSUCCESSisthereturnvalueofnErrandthevalueacquiredbyBiGetCounterafterresetting themaintenancecounter,thisconfirmsnormalexecution. Thefollowingoperationsareexecutedaccordingtotheprinterstatuswhenthisfunctionis called.
Printer Status
Online Offline Cable Removed/Power Off Printing
Operation
Returns "SUCCESS" to nErr. Resets the maintenance counter. Returns "ERR_TIMEOUT" to nErr. Does not reset the maintenance counter. Returns "ERR_ACCESS" to nErr. Does not reset the maintenance counter. Returns "ERR_ACCESS" to nErr. Does not reset the maintenance counter.
62
BiGetPrnCapability
AcquiresthespecifiedprinterinformationinprinterID.
For information on the Printer Capability that can be acquired, ask your dealer.
Syntax
nErr = BiGetPrnCapability (nHandle, prnID, pBuffSize, pBuff)
SpecifythehandleinnHandleandspecifytheacquiringprinterinformationtoprnID.Specifythe memorysizetosettheprinterinformationinpBuffSizeandspecifythememoryaddresstosetthe printerinformationinpBuff.
Argument
nHandle: prnID: pBuffSize: Specifiesthehandle.ThisisanINTtype. Specifiestheacquiringprinterinformation.ThisisaBYTEtype. Specifiesthememorysizetosettheprinterinformation(1to80).Returnsthe actualreaddatasizeaftercallingthisfunction.Inthecaseofinsufficientbuffer capacity,therequiredbytesizeisreturned.ThisisaLPBYTEtype. Specifiesthememoryaddresstosettheprinterinformation.ThisisaLPBYTE type.
pBuff:
Return value
ReturnsthefollowingStatusAPIexecutionerrors(value)tothevariable(nErr)definedbythe INTtype.ReturnsSUCCESS(macrodefinition)whenthisfunctionissuccessfullycalled.
Value
0 -60 -70 -80 -90 -140 -310 Success
Description
Specified handle is invalid Timeout error R/W cannot be performed on the printer Parameter error Lack of buffer capacity. This function is unavailable as Status API is used by other applications.
63
Value
-340 -400 -1000
Description
The PortHandler is not running or a communication error between the client of PortHandler and the server. Cannot call as the printer is restarting The printer is locked.
For information on remedies for the Status API execution errors, refer to "Status API Execution Error" on page 25.
64
BiOpenDrawer
Opensthedrawer.
Opens the drawer even when the printer is offline.
Syntax
nErr = BiOpenDrawer (nHandle, drawer, pulse)
SpecifythehandleinnHandle.Specifythedrawertoopenindrawerandspecifythetimeuntilthe draweropensinpulse.
Argument
nHandle: drawer: Specifiesthehandle.ThisisanINTtype. Specifiesthedrawertoopen.ThisisaBYTEtype.
Macro Definition (Constant)
EPS_BI_DRAWER_1 EPS_BI_DRAWER_2
Value
1 2 Opens drawer 1 Opens drawer 2
Description
pulse:
Specifiesthetimewhenthedrawerkicksignalison.ThisisaBYTEtype.
Macro Definition (Constant)
EPS_BI_PLUSE_100 EPS_BI_PLUSE_200 EPS_BI_PLUSE_300 EPS_BI_PLUSE_400 EPS_BI_PLUSE_500 EPS_BI_PLUSE_600 EPS_BI_PLUSE_700 EPS_BI_PLUSE_800
Value
1 2 3 4 5 6 7 8
Description
Signal for 100 milliseconds Signal for 200 milliseconds Signal for 300 milliseconds Signal for 400 milliseconds Signal for 500 milliseconds Signal for 600 milliseconds Signal for 700 milliseconds Signal for 800 milliseconds
65
Return value
ReturnsthefollowingStatusAPIexecutionerrors(value)tothevariable(nErr)definedbythe INTtype.ReturnsSUCCESS(macrodefinition)whenthisfunctionissuccessfullycalled.
Value
0 -60 -80 -90 -100 -310 -340 -400 -1000 Success
Description
Specified handle is invalid R/W cannot be performed on the printer Parameter error Not supported This function is unavailable as Status API is used by other applications. The PortHandler is not running or a communication error between the client of PortHandler and the server. Cannot call as the printer is restarting The printer is locked.
For information on remedies for the Status API execution errors, refer to "Status API Execution Error" on page 25.
Comment
Thefollowingoperationsareexecutedaccordingtotheprinterstatuswhenthisfunctionis called.
Printer Status
Online Offline Cable Removed/Power Off
Operation
Returns "SUCCESS" to nErr. Opens the drawer. Returns "SUCCESS" to nErr. Opens the drawer. Returns "ERR_ACCESS" to nErr. Does not open the drawer.
66
BiSendDataFile
Specifythecommanddefinitionfiletodefinethetransmissioncommand(ESC/POScommand).
Specify the command definition file in the specified format. Contact the dealer regarding ESC/POS commands.
Syntax
nErr = BiSendDataFile (nHandle, lpcFileName)
SpecifythehandleinnHandleandthecommanddefinitionfilenameinlpcFileName.
Argument
nHandle: lpcFileName: Specifiesthehandle.ThisisanINTtype. Specifiesthecommanddefinitionfilename.ThisisaLPCSTRtype.
Return value
ReturnsthefollowingStatusAPIexecutionerrors(value)tothevariable(nErr)definedbythe INTtype.ReturnsSUCCESS(macrodefinition)whenthisfunctionissuccessfullycalled.
Value
0 -50 -60 -90 -310 Success Not enough memory
Description
Specified handle is invalid Parameter error 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 25.
Comment
Describethecommanddefinitionfileusingthefollowingformat.
#CutPaper
'Comment
CutPaper=0a1d564200
Command Name Registered Transmission Data
67
Caution
Handlecharacterstringsfollowing#ascomments. Thecharacterstringlistedtotheleftof=isthecommandnameofthedatatobewrittento the printer and the character string listed to the right of= is theregistered transmission data. Ensurethatcharacterstringsarelistedusingparentheses(). Listbinarydataastwodigithexadecimals. Themaximumsizeofcommandnamesis33bytes(33charactersinANK). The maximum size ofregistered transmission data is 10,240 bytes. However, the size of the registered transmission data is not the length of anASCIIZ character string but the size afterconvertingthedatatobinary.Refertothefollowingexamples. Example) ABC=ABC:Themaximumsizeofregisteredtransmissiondatais3bytes. ABC=ABC0D0A:Themaximumsizeofregisteredtransmissiondatais 5bytes. ABC=4142430D0A:Themaximumsizeofregisteredtransmissiondata is5bytes.
If a command name is already registered, stop the command registration process and return anerror. The number of commands that can be registered is limited to the usable memory of the sys tem. CalltheBiCloseMonPrinterfunctiontocanceltheregisteredcommanddata.
68
BiDirectSendRead
ExecutesthecommanddefinedinBiSendDataFile(ESC/POScommands).
Contact the dealer regarding ESC/POS commands.
Syntax
nErr = BiDirectSendRead (nHandle, lpcCmdName, lpcReadName, readLen, pReadBuf, Timeout, nullTerminate )
Refertothenextargument.
Argument
nHandle: lpcCmdName: lpcReadName: readLen: preadBuff: Timeout: nullTerminate: Specifiesthehandle.ThisisanINTtype. Specifiesthecommandnameofthecommanddefinitionfilename.Thisisa LPCSTRtype. Specifiesthereceivingdatatypenameofthedatareadfromtheprinter. RefertoPage"BiSendDataFile" on page 67.ThisisaLPCSTRtype. Specifiesthedatalengthreadfromtheprinter.Doesnotwritetotheprinter when0.Returnsthedatalengthwhenreading.ThisisaLPDWORDtype. Specifiesthebuffersavingthedatareadfromtheprinter. ThisisaLPBYTEtype. Specifiesthetimeouttimeinms(milliseconds).ThisisaDWORDtype. InthecaseofTRUE,readingiscompletewhenNULLisreceivedfromthe printer.Atthistime,specifythereadBuffsizetoreadLen. InthecaseofFALSE,thelengthofdataspecifiedinreadLenisreadordata isreadfromtheprinteruntilatimeouterrorisgenerated.
Ensure that the size of preadBuff is the same length specified in readLen or longer.
Return value
ReturnsthefollowingStatusAPIexecutionerrors(value)tothevariable(nErr)definedbythe INTtype.ReturnsSUCCESS(macrodefinition)whenthisfunctionissuccessfullycalled.
Value
0 -50 Success Not enough memory
Description
69
Value
-60 -70 -80 -90 -310 -340 -400 -1000
Description
Specified handle is invalid Timeout error R/W cannot be performed on the printer Parameter error This function is unavailable as Status API is used by other applications. The PortHandler is not running or a communication error between the client of PortHandler and the server. Cannot call as the printer is restarting The printer is locked.
For information on remedies for the Status API execution errors, refer to "Status API Execution Error" on page 25.
Comment
Thisfunctionspecifiesthename(macroname)previouslyspecifiedinthecommanddefinition file.Thefollowingdatatypescanbespecifiedasresponsesfromtheprinter.
Data Types
ASB ASB Extended Ptr Info Byte Ptr Info String Power OFF Power ON Realtime Buffer Clear Slip Remaining NVM Image Size NVM Image Free NVM Image Keys NVM Image List NVM User Used NVM User Free NVM User Get NVM User Keys NVM Set Mode NVM Get Mswitch NVM Set Size
Description
Automatic status transmission Automatic status transmission regarding extended status Printer ID information Printer information B Power OFF notification Power ON notification Realtime transmission of status Buffer clear Dot count transmission of remaining print area of a single-cut sheet Transmission of full capacity of NV graphics area Transmission of remaining capacity of NV graphics area Transmission of the key code list of defined NV graphics Transmission of the data ID list of image reading results saved to NV memory for storage Transmission of usage capacity (byte count of used area) Transmission of remaining capacity (byte count of unused area) Transmission of the storage data of a specified record Transmission of the key code list of a storage record Transmission of transfer notification to user settings mode Transmission of memory switch values Transmission of customized values
70
Data Types
Ptr Info Type A Test Print RAM Image Free RAM Image Keys OfflineCode Bit OfflineCode Data ProcessID Data Types Buffer Clear24 Other Printer information A Execution of test print
Description
Transmission of remaining area of download graphics area Transmission of the key code list of defined download graphics Transmission of offline response (bit format) Transmission of offline response (data format) Transmission of process ID response Description Buffer clear 24 Data not applicable to the aforementioned
71
BiSetDefaultEchoTime
Configurestheresponseconfirmationfrequencyofthenetworkprinterandtheinitialtimevalue forasingletimeout.
Can only be used when connected by Ethernet.
Syntax
nErr = BiSetDefaultEchoTime (Count, Timeout)
ConfigurestheresponseconfirmationfrequencytoCountandthesingletimeouttimetoTimeout.
Argument
Count: Timeout: Configurestheresponseconfirmationfrequency(1to255).ThisisaBYTEtype. Configuresthesingletimeouttime(1to65535)inms(millisecond)units. ThisisaWORDtype.
Return value
ReturnsthefollowingStatusAPIexecutionerrors(value)tothevariable(nErr)definedbythe INTtype.ReturnsSUCCESS(macrodefinition)whenthisfunctionissuccessfullycalled.
Value
0 -90 -310 -340 Success Parameter error
Description
This function is unavailable as Status API is used by other applications. 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 25. When a shred printer is accessed from a client that does not have PortHandler, the printer returns ERR_PH_NOT_EXIST.
72
Comment
Theresponseconfirmationfrequencyisthreetimesandthetimeouttimeis1second immediatelyafterinstallingStatusAPI.TheconfigurationwiththisAPIwillbevalidafterrestart thecomputer.TheconfigurationwiththisAPIwillbevalidtothealloftheTMprinters(w/ EthernetPort)whichareconnectedtothecomputer.
73
BiSetEtherEchoTime
Configurestheresponseconfirmationfrequencyofthenetworkprinterandthetimeouttimefor onetimeafterStatusAPIisavailable.
Can only be used when connected by Ethernet.
Syntax
nErr = BiSetEtherEchoTime (nHandle, Count, Timeout)
SpecifythehandleinnHandle.ConfigurestheresponseconfirmationfrequencytoCountandthe singletimeouttimetoTimeout.
Argument
nHandle: Count: Timeout: Specifiesthehandle.ThisisanINTtype. Configurestheresponseconfirmationfrequency(1to255).ThisisaBYTEtype. Configuresthesingletimeouttime(1to65535)inms(millisecond)units. ThisisaWORDtype.
Return value
ReturnsthefollowingStatusAPIexecutionerrors(value)tothevariable(nErr)definedbythe INTtype.ReturnsSUCCESS(macrodefinition)whenthisfunctionissuccessfullycalled.
Value
0 -60 -80 -90 -100 -310 -340 -1000 Success
Description
Specified handle is invalid R/W cannot be performed on the printer Parameter error Not supported Cannot call as another Status API is in use The PortHandler is not running or a communication error between the client of PortHandler and the server. The printer is locked.
For information on remedies for the Status API execution errors, refer to "Status API Execution Error" on page 25.
Comment
Ifavalueisnotconfiguredtothisfunction,thevaluesetintheBiSetDefaultEchoTimefunctionis used.
74
BiSetReadWaitTimeOut
ThisisacompatibleAPI.ThisAPIitselfhasnofunction.
Syntax
nErr = BiSetReadWaitTimeOut (nHandle, wTimeOut)
Argument
nHandle: wTimeOut: Specifiesthehandle.ThisisanINTtype. Notused.ThisisaWORDtype.
Return value
ReturnsthefollowingStatusAPIexecutionerrors(value)tothevariable(nErr)definedbythe INTtype.ReturnsSUCCESS(macrodefinition)whenthisfunctionissuccessfullycalled.
Value
0 Success
Description
For information on remedies for the Status API execution errors, refer to "Status API Execution Error" on page 25.
75
76
Properties
IsValid
Acquirestheopenstatusoftheprinter. Access:
Datatype:
Readonly System.Boolean
Explanation
Returnseitherofthefollowingvalues. true: false: Successfullyopened. Notopenedorfailedtobeopened.
LastError
AcquirestheerrorcodeofthelastexecutedAPI. Access: Datatype: Readonly com.epson.pos.driver.ErrorCode
Explanation
CanacquireanerrorcodeatanytimebecausethismoduleretainsthelastexecutedAPI. ThismethodisusedtojudgesuccessorfailurebecauseAPIsimplementedinpropertiescannot returnerrorcodes. ErrorcodesforerrorsthatmayoccurinallAPIs.Fordetails,seeStatusAPIExecutionErroron page25.
77
Status
CallsBiGetSatusinAPD4StatusAPIandacquiresthecurrentprinterstatus. Access: Datatype: Readonly com.epson.pos.driver.ASB
Explanation
Constantsdefinedincom.epson.pos.driver.ASBshallbeusedforthevalue.Fordetails,see BiGetStatusonpage50.
78
Methods
OpenMonPrinter
Startscontrollingthespecifiedprinter. CallsBiOpenMonPrinterinAPD4StatusAPI.Fordetails,seeBiOpenMonPrinteronpage30.
Prototype
ErrorCode OpenMonPrinter (OpenType type, String name)
Parameters
OpenTypetype: Stringname: Typeofnametobespecifiedforname.Constantsdefinedin com.epson.pos.driver.OpenTypeshallbeusedforthevalue. Startscontrollingthespecifiedprinter.
CloseMonPrinter
Stopscontrollingthespecifiedprinter. CallsBiCloseMonPrinterinAPD4StatusAPI.Fordetails,seeBiCloseMonPrinteronpage32.
Prototype
ErrorCode CloseMonPrinter ()
79
LockPrinter
Occupiestheprinter. CallsBiLockPrinterinAPD4StatusAPI.Fordetails,seeBiLockPrinteronpage33.
Prototype
ErrorCode LockPrinter (int timeout)
Parameters
inttimeout: Timeouttime(inmsunits).
UnlockPrinter
Stopsoccupyingtheprinter. CallsBiUnLockPrinterinAPD4StatusAPI.Fordetails,seeBiUnlockPrinteronpage35.
Prototype
ErrorCode UnlockPrinter ()
80
SetMonInterval
SpecifiestheintervalforStatusAPItoreadthestatusoftheprinter. CallsBiSetMonIntervalinAPD4StatusAPI.Fordetails,seeBiSetMonIntervalonpage36.
Prototype
ErrorCode SetMonInterval( int noPrnInterval, int prnInterval )
Parameters
intnoPrnInterval: Unused intprnInterval: Printermonitoringinterval
SetMonEtherInterval
SpecifiestheintervalforStatusAPItoreadthestatusoftheprinter. CallsBiSetMonEtherIntervalinAPD4StatusAPI.Fordetails,seeBiSetMonEtherIntervalon page37.
Prototype
ErrorCode SetMonEtherInterval (int EtherInterval)
Parameters
intEtherInterval: Networkprintermonitoringinterval
81
DirectIOEx
Aftersendingthespecifieddatatotheprinter,receivesdataofthespecifiedlengthfromthe printer. CallsBiDirectIOExinAPD4StatusAPI.Fordetails,seeBiDirectIOExonpage40.
Prototype
ErrorCode DirectIOEx (byte[] writeCmd, ref byte[] readBuff, int timeout, bool nullTerminate, byte option)
Description: SendstheESC/POScommandstotheTMprinterandreceivestheexecution result(binarydata)fromtheprinter.
ErrorCode DirectIOEx (byte[] writeCmd, out String response, int timeout, byte option)
Description: SendstheESC/POScommandstotheTMprinterandreceivestheexecution result(characterstringdata)fromtheprinter.
Parameters
byte[]writeCmd: refbyte[]readBuff: inttimeout: byteoption: Datatobesenttotheprinter Datareceivedfromtheprinter Timeouttimefordatatransmissionandreception(inmsunits) InthecaseofTrue,readingiscompletewhenNULLisreceivedfromthe printer.Atthistime,specifythereadBuffsizetoreadLen. InthecaseofFALSE,thelengthofdataspecifiedinreadLenisreador dataisreadfromtheprinteruntilatimeouterrorisgenerated.
boolnullTerminate: WhetherornottoterminatereceptionwhenNULLisreceived
outStringresponse: Datareceivedfromtheprinter(tobeconvertedintostrings)
82
ResetPrinter
Resetstheprinter.Whenresettingtheprinterduringprinting,cancelsprintjobsandperforms printerresetting. CallsBiResetPrinterinAPD4StatusAPI.Fordetails,seeBiResetPrinteronpage44.
Prototype
ErrorCode ResetPrinter ()
ForceResetPrinter
ForcestoresettheTMprinterwhosestatusisbeingmonitored. CanresetalsotheTMprintersoccupiedwithLockPrinter.ThisalsoresetsTMprintersduring printing.BecarefulinusingthisAPI. CallsBiForceResetPrinterinAPD4StatusAPI.Fordetails,seeBiForceResetPrinteronpage46.
Prototype
ErrorCode ForceResetPrinter()
CancelError
CallsBiCancelErrorinAPD4StatusAPI.Performsrecoveryfromaprinterrecoverableerror. Fordetails,seeBiCancelErroronpage47.
Prototype
ErrorCode CancelError ()
83
GetType
AcquiresthetypeIDoftheprinter.Someinformationcannotbeacquireddependingonthe model.Insuchacase,0isset. CallsBiGetTypeinAPD4StatusAPI.Fordetails,seeBiGetTypeonpage49.
Prototype
ErrorCode GetType (out byte typeid, out byte font, out byte exrom, out byte euspecial)
Parameters
outbytetypeid: outbytefont: outbyteexrom: outbyteeuspecial: TypeIDoftheprinter Fontsinstalledintheprinter CapacityoftheprintersextendedFlashROM. SpecialIDoftheprinter
GetRealStatus
Acquiresthemostrecentstatusoftheprinter.Individualbitsinthestatuscorrespondtothe contentsoftheASBstatusandconstantsdefinedincom.epson.pos.driver.ASBshallbeused. CallsBiGetRealStatusinAPD4StatusAPI.Fordetails,seeBiGetRealStatusonpage51.
Prototype
ErrorCode GetRealStatus (out ASB asb)
Parameters
outASBasb: Currentprinterstatus
84
SetStatusBack
StartsstatusnotificationthroughStatusCallback/StatusCallbackExevents. CallsBiSetStatusBackFunctionExinAPD4StatusAPI.Fordetails,see BiSetStatusBackFunctionExonpage54.
Prototype
ErrorCode SetStatusBack ()
CancelStatusBack
StopsstatusnotificationthroughStatusCallback/StatusCallbackExevents. CallsBiCancelStatusBackinAPD4StatusAPI.Fordetails,seeBiCancelStatusBackonpage57.
Prototype
ErrorCode CancelStatusBack ()
PowerOff
Executesthepoweroffprocessoftheprinter. CallsBiPowerOffinAPD4StatusAPI.Fordetails,seeBiPowerOffonpage58.
Prototype
ErrorCode PowerOff ()
85
GetCounter
Readsthemaintenancecounter. CallsBiGetCounterinAPD4StatusAPI.Fordetails,seeBiGetCounteronpage59.
Prototype
ErrorCode GetCounter (CounterIndex counter, bool cumulative, out int value)
Description: WiththecombinationofCounterIndexcounterandboolcumulative,calculates thecounternumberandacquiresthevalueofthecounter.
Parameters
CounterIndexcounter: boolcumulative: MaintenancecounternumberConstantsdefinedin com.epson.pos.driver.CounterIndexshallbeusedforthevalue. Whetherornotthemaintenancecounternumberspecifiedbycounter referstothecumulativecounter true: cumulativecounter false: resetcounter Maintenancecountervalue Maintenancecounternumber
outintvalue: bytecounter:
86
ResetCounter
Resetsthemaintenancecounter. CallsBiResetCounterinAPD4StatusAPI.Fordetails,seeBiResetCounteronpage61.
Prototype
ErrorCode ResetCounter (CounterIndex counter)
Description: Resetthevalueofcounterspecifiedwiththe com.epson.pos.driver.CounterIndex.
Parameters
CounterIndexcounter: MaintenancecounternumberConstantsdefinedin com.epson.pos.driver.CounterIndexshallbeusedforthevalue. bytecounter: Maintenancecounternumber
GetPrnCapability
AcquiresinformationabouttheprinterspecifiedbytheprinterID. CallsBiGetPrnCapabilityinAPD4StatusAPI.Fordetails,seeBiGetPrnCapabilityonpage63.
Prototype
ErrorCode GetPrnCapability (byte printerID, out byte[] data)
Description: Acquiresinformation(binarydata)oftheTMprinterspecifiedwithprinterID.
Parameters
byteprinterID: outbyte[]data: outStringdata: IDoftheprinterfromwhichinformationisacquired. Printerinformation Printerinformation
87
OpenDrawer
Activatesthedrawer.Canbeusedalsowhentheprinterisoffline. CallsBiOpenDrawerinAPD4StatusAPI.Fordetails,seeBiOpenDraweronpage65.
Prototype
ErrorCode OpenDrawer (Drawer drawer, Pulse pulse)
Parameters
Drawerdrawer: Pulsepulse: DrawertobeopenedConstantsdefinedincom.epson.pos.driver.Drawer shallbeusedforthevalue. Specifiesthetimewhenthedrawerkicksignalison. Constantsdefinedincom.epson.pos.driver.Pulseshallbeusedforthe value.
SendDataFile
Registerscommandsbyusingthecommanddefinitionfile.Forthefileformatofthecommand definitionfile,seethedescriptionsinthesubsequentsections.
Prototype
ErrorCode SendDataFile (String filename)
Parameters
Stringfilename: CommanddefinitionfileFileinthecurrentfolderisusedifnopathis specified.
Explanation
TheregisteredcommanddataisdiscardedwhenCloseMonPrinerisexecuted.Ifthesame commandnameisfoundtobealreadyregistered,abortscommandregistrationandreturnsan error. Thenumberofcommandsthatcanberegisteredisrestrictedonlybytheavailablememoryspace ofthesystem. CallsBiSendDataFileinAPD4StatusAPI. Fordetails,seeBiSendDataFileonpage67.
88
DirectSendRead
TransmitsthecommandsregisteredthroughSendDataFileandreceivesthedataspecifiedwith thedatatypenameofdatatobereceived. CallsBiDirectSendReadinAPD4StatusAPI.Fordetails,seeBiDirectSendReadonpage69.
Prototype
ErrorCode DirectSendRead (String cmdName, String readName, ref byte[] readBuf, int timeout, bool nullTerminate)
Description: SendsacommanddefinedwithSendDataFiletoaTMprinterandreceivesthe executionresult(binarydata)fromtheprinter.
ErrorCode DirectSendRead (String cmdName, String readName, out String response, int timeout)
Description: SendsacommanddefinedwithSendDataFiletoaTMprinterandreceivesthe executionresult(characterstringdata)fromtheprinter.
Parameters
StringcmdName: StringreadName: refbyte[]readBuf: inttimeout: Commandname Datatypenameofdatatobereceived Receiveddata Timeouttimefordatatransmissionanddatareception(inmsunits)
89
SetDefaultEchoTime
Setsinitialvaluesforthenumberofresponseconfirmationtimesandforthetimeouttimeper oneresponseconfirmation,tothenetworkprinter. WhenAPD4StatusAPIisinstalledforthefirsttime,thenumberofconfirmationresponsetimes isoneandthetimeouttimeperthreeresponseconfirmationis1second. TheconfigurationwiththisAPIwillbevalidafterrestartthecomputer. NotethatthisAPIisexecutableonlyduringEthernetconnection. CallsBiSetDefaultEchoTimeinAPD4StatusAPI.Fordetails,seeBiSetDefaultEchoTimeon page72.
Prototype
ErrorCode SetDefaultEchoTime (int count, int timeout)
Parameters
intcount: inttimeout: Numberofresponseconfirmationtimes Timeouttimeperoneresponseconfirmation(inmsunits)
SetEtherEchoTime
Setsvaluesforthenumberofresponseconfirmationtimesandforthetimeouttimeperone responseconfirmation,tothenetworkprinter.BeforethisAPIexecutes,thevaluessetwith SetDefaultEchoTimeareused.NotethatthisAPIisenabledonlyduringEthernetconnection. CallsBiSetEtherEchoTimeinAPD4StatusAPI.Fordetails,seeBiSetEtherEchoTimeonpage 74.
Prototype
ErrorCode SetEtherEchoTime (int count, int timeout)
Parameters
intcount: inttimeout: Numberofresponseconfirmationtimes Timeouttimeperoneresponseconfirmation
90
Events
StatusCallback
EventthathandlesASBstatusnotification. CorrespondstothecallbackfunctionspecifiedbyBiSetStatusBackFunctioninAPD4StatusAPI. Fordetails,seeBiSetStatusBackFunctiononpage52.
Prototype
StatusCallbackHandler (ASB asb)
Parameters
ASBasb: ASBstatusConstantsdefinedincom.epson.pos.driver. ASBshallbeusedforthevalue.
StatusCallbackEx
EventthathandlesASBstatusnotification. CorrespondstothecallbackfunctionspecifiedbyBiSetStatusBackFunctionExinAPD4Status API. Fordetails,seeBiSetStatusBackFunctionExonpage54.
Prototype
StatusCallbackHandlerEx (ASB asb, String portName)
Parameters
ASBasb: StringportName: ASBstatusConstantsdefinedincom.epson.pos.driver. ASBshallbeusedforthevalue. Portname
91
92
Makethefollowingsettingsonthetab.
Setting
Logging Enable (Default) Disable Specify where to output the log file. (Default) Windows XP: Log File Directory
C:\Documents and Settings\All Users\Application Data\EPSON\devicecontrollog
Description
Enables log output. Disables log output.
Windows 7 / Vista:
C:\ProgramData\EPSON\devicecontrollog
Windows 8
C:\ProgramData\epson\devicecontrollog The ProgramData folder is a hidden folder.
Specify the upper limit of the log file size. (Range: 10 to 1024, Default: 40) Log Size Limit (MB) When the upper limit is exceeded, the log file is compressed in zip format. The subsequent log information is saved as a new log file. The file compression date is used as the zip file name. (example: 201107071130.zip)
93
Format
Date,time,process ID:thread ID,source hierarchy name,arbitrary message,binary data
[Output date] [Process ID:Thread ID] [Arbitrary message]
2011/07/14,15:07:14.644,00000acc:000015d8,API,->
[Output time]
Logs of arbitrary message are output in an applicable format according to the element of each log. For details, see "Arbitrary message" on page 94. Binary data is print data and may be omitted.
Arbitrary message
Logsofarbitrarymessageareoutputinanapplicableformataccordingtotheelementofeach log.
Element
Function call <Format> ->,handle_value,,function_name,parameter_1,parameter_2,... Output when a process returns from a public function of each module. Function return <Format> <-,handle_value,return_value,function_name,parameter_1,parameter_2,...
Description
Output when a public function of each module is called.
94
95
96
Appendix
Appendix
Model Information
ThisdocumentexplainstheinformationacquiredbyStatusAPIfortheTMT81.
TM-T81
ASB Status
Macro Definitions
ASB_NO_RESPONSE OFF ON ASB_PRINT_SUCCESS OFF ON ASB_DRAWER_KICK OFF ON ASB_OFF_LINE OFF ON ASB_COVER_OPEN OFF ON ASB_PAPER_FEED OFF ON ASB_AUTOCUTTER_ERR OFF ON ASB_UNREOVER_ERR OFF ON ASB_AUTORECOVER_ERR OFF ON ASB_RECEIPT_NEAR_END OFF 0x00000000 Paper in the roll paper near end detector 0x00000000 Auto recovery error not generated 0x00020000 No paper in the roll paper near end detector 0x00000000 Unrecoverable error not generated 0x00004000 Auto recovery error generated 0x00000000 Auto cutter error not generated 0x00002000 Unrecoverable error generated 0x00000000 Paper feed switch is not feeding paper 0x00000800 Auto cutter error generated 0x00000000 Cover is closed 0x00000040 Paper feed switch is feeding paper 0x00000000 Online status 0x00000020 Cover is open 0x00000000 Status of the drawer kick number 3 connector pin = "L" 0x00000000 0x00000004 Status of the drawer kick number 3 connector pin = "H" 0x00000000 Printer response 0x00000002 Print complete
ON/ OFF
ON
Value
0x00000001 No printer response
Status
97
Macro Definitions
ASB_RECEIPT_END
ON/ OFF
ON OFF ON
Value
Status
0x00080000 No paper in the roll paper end detector 0x00000000 Paper in the roll paper end detector 0x80000000 Stop the spooler 0x00000000 Operation the spooler
ASB_SPOOLER_IS_STOPPED OFF
Maintenance Counter
Counter Number (readno)
20 (14H) 21 (15H) 50 (32H) 70 (46H) 148 (94H) 149 (95H) 178 (B2H) 198 (C6H)
Resetability
Resetable Resetable Resetable Resetable Cumulative Cumulative Cumulative Cumulative
Counter (readcounter)
Number of line feeds (for roll paper) Number of times head is energized (for roll paper) Number of autocutter operations Printer operation time Number of line feeds (for roll paper) Number of times head is energized (for roll paper) Number of autocutter operations Printer operation time
Unit
Lines Times Times Hours Lines Times Times Hours
98