Home

ePOS-Print SDK for Android User`s Manual

image

Contents

1. 69 70 addTextPosition Adds the horizontal print start position of text to the command buffer 2 After executing this API you cannot use addTextAlign p 59 or addTextRotate p 61 Syntax public void addTextPosition int x throws EposException Parameter e x Specifies the horizontal print start position in dots Specifies an integer from O to 65535 Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Example To set the print position at 120 dots from the left end try Builder builder new Builder TM T88V Builder MODEL_ANK builder addTextPosition 120 Process catch EposException e int errStatus e getErrorStatus Chapter 4 API Reference addFeedUnit Adds paper feeding in dots to the command buffer Syntax public void addFeedUnit int unit throws EposException Parameter e unit Specifies the paper feed space in dots Specifies an integer from O to 255 Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Example To feed paper by 30 dots try Builder buil
2. 137 138 setBatteryOkEventCallback This registers the notification destination of a battery OK event This refers to events that are notified when the printer status recovers from offline due to remaining battery power When this API is executed on multiple occasions the notification destination that is specified e This API can be executed following execution of openPrinter p 114 Q afterwards is overwritten Syntax public void setBatteryOkEventCallback BatteryOkEventListener target Parameter e target This specifies the object listener interface that has the notification destination method listener registration method If null is specified for either the method or target the noti fication destination registration is nullified Listener Interface public interface BatteryOkEventListener extends EventListener Listener Registration Method void onBatteryOkEvent String deviceName Parameter e deviceName The identifier IPv4 format IP address BD address Device node Printer host name of the device that performed battery OK event notification is set Example public class SampleActivity extends Activity implements OnClickListener BatteryOkEventListener Process private void onBatteryOkEvent String deviceName Process private void openPrinter Print printer new Print printer setBatteryOkEventCallback this try printer openPrinter Print DE
3. Default Line Feed Space 30 dots Color Specification First color Page Mode Default Area 420 dots x 831 dots W x H 576 dots x 831 dots W x H Page Mode Maximum Area 420 dots x 1662 dots W x H 576 dots x 1662 dots W x H Barcode UPC A UPC E EAN13 JAN13 EAN8 JAN8 CODE39 ITF CODABAR CODE93 CODE128 GS1 128 GS1 DataBar Omnidirectional 6S1 DataBar Truncated GS1 DataBar Limited 6S1 DataBar Expanded Two Dimensional Code PDF417 QR Code MaxiCode 6S1 DataBar Stacked GS1 DataBar Stacked Omnidirectional GS1 DataBar Expanded Stacked Composite Symbology Paper Cut Cut Feed cut Drawer Kick Out Not supported Buzzer Optional Battery Supported Only for Traditional Chinese model 178 Appendix Battery Status Upper 8 bits 0x30 The AC adapter is connected 0x31 The AC adapter is connected Lower 8 bits 0x30 Battery amount 0 real end 0x31 Battery amount I nearen SSS 0x32 Battery amount 2 0x33 Battery amount 3 0x34 Battery amount 4 0x35 Battery amount 5 0x36 Battery amount 6 Q If Ox0000 is returned the battery status cannot be acquired 179 TM P80 80 mm Interface Wi Fi Bluetooth USB Resolution 203 dpi x 203 dpi W x H Language e ANK model e Traditional Chinese model Print Width 576 dots Characters in a Line Font A ANK 48 characters Font B ANK 64 characters Kanji font
4. Syntax public void setDrawerClosedEventCallback DrawerClosedEventListener target Parameter e target This specifies the object listener interface that has the notification destination method listener registration method If null is specified for either the method or target the noti fication destination registration is nullified Listener Interface public interface DrawerClosedEventListener extends EventListener Listener Registration Method void onDrawerClosedEvent String deviceName Parameter e deviceName The identifier IPv4 type IP address BD address Device node Printer host name of the device thot is notified of drawer closed event is set Example public class SampleActivity extends Activity implements OnClickListener DrawerClosedEventListener Process private void onDrawerClosedEvent String deviceName Process private void openPrinter Print printer new Print printer setDrawerClosedEventCallback this try printer openPrinter Print DEVTYPE_TCP 192 168 192 168 Print TRUE Print PARAM DEFAULT Process catch EposException e int errStatus e getErrorStatus 135 136 setDrawerOpenEventCallback This registers the notification destination of drawer open events This refers to events that are notified when printer status is drawer open When this API is executed on multiple occasions the notification
5. 57 clearCommandBuffer Clears command buffers used by APIs of the Builder class The command buffers stored in the Builder class instance will be retained until this API is executed Syntax public void clearCommandBuf fer Example If you are clearing the command buffer try Builder builder new Builder TM T88V Builder MODEL_ANK Process builder clearCommandBuf fer Process catch EposException e int errStatus e getErrorStatus Chapter 4 API Reference addTextAlign Adds the text alignment setting to the command buffer This API setting also applies to barcodes 2D Code Q When the page mode is selected use addPagePosition p 97 instead of this API to set the alignment Syntax public void addTextAlign int align throws EposException Parameter e align Specifies the text alignment Builder ALIGN_LEFT default Alignment to the left Builder ALIGN_CENTER Alignment to the center Builder ALIGN_RIGHT Alignment to the right Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Example To set alignment to the center try Builder builder new Builder TM T88V Builder MODEL_ANK builder addTextAlign Builder ALIGN CENT
6. 146 setting Q Return value For TCP or USB connection only EPSON printers are searched for regardless of the FitlerOption The device information list Devicelnfo of devices found during search is returned Device information is stored in the list as a Devicelnfo type array Information to be stored varies depending on the device type deviceType Devicelnfo Information to be obtained DevType TCP getDevicelypeQ DevType TCP Fixed getPrinterNameQ Printer model name getDeviceName e DHCP disabled IP address e DHCP enabled MAC address getlpAdaressO IP Address getMacAddressQ MAC Address DevType BLUETOOTH getDevicelypeQ DevType BLUETOOTH Fixed getPrinterNameQ Bluetooth device name getDeviceNameQ BD Address the same format as the MAC address format getloAdadressQ Empty character getMacAddresso Emptycharactey 2 DevType USB getDevicelype O DevType USB Fixed getPrinterName USBdevicename ll getDeviceNameQ Device node getlbAddresQ Emptycharactern getMacAdaress Empty character Chapter 4 API Reference Exceptions When processing fails EpsonloException is thrown with one of the following error values loStatus ERR_ILLEGAL This API was called when a search was already in progress loStatus ERR_PROCESSING Could not execute process loStatus ERR_PARAM Invalid parameter was passed loStatus ERR_MEMORY Could not allocate memor
7. When processing fails EpsonloException is thrown with one of the following error values Error Value Description loStatus ERR_ILLEGAL This API was called when a search was already in progress loStatus ERR_PROCESSING Could not execute process loStatus ERR_PARAM Invalid parameter was passed loStatus ERR_MEMORY Could not allocate memory loStatus ERR_FAILURE An unspecified error occurred 144 Chapter 4 API Reference Stops the printer search Syntax public static synchronized void stop throws EpsonloException Exceptions When processing fails EpsonloException is thrown with one of the following error values loStatus ERR_ILLEGAL This API was called when a search was not in progress loStatus ERR_PROCESSING Could not execute process loStatus ERR_FAILURE An unspecified error occurred 145 getDeviceinfolist Acquires the results of device search until this API is called 2 This API cannot acquire Bluetooth devices or USB devices that are already open Syntax public static synchronized final Devicelnfol getDeviceInfoList int filterOption throws EpsonloException Parameter e filterOption This specifies the filtering method for EPSON printers Specify one of the following values Do not filter Set value FilterOption FILTER_NONE FilterOption FILTER_NAME FilterOption PARAM_DEFAULT Filter in the printer name Filter in the printer name
8. addCut p 102 VIV VIV VI VI VI VI Vi ViVi vi vi viv iv viy addPulse p 103 I IV Vivii vi Vv vivi viv iv addSound p 104 Y I vVv v iv v v viv vid v addSound Previous format p 106 W YU VU VI v v v vv v v addFeedPosition p 108 Y I VW W W Vv addLayout p 109 YVI vV v iv SE E A E addCommand p 111 VIVIVIVI VI VI V ViVi vi vidi Vi v vV 169 Support Information by Printer TM T88V 58 mm 80 mm Interface Ethernet Wi Fi Bluetooth USB Resolution 180 dpi x 180 dpi W x H Language e ANK model e Japanese model e Simplified Chinese model e Traditional Chinese model e Korean model e South Asian model Print Width 360 dots 512 dots Characters in a Line Font A ANK 30 characters ANK 42 characters Font B ANK 40 characters ANK 52 characters Character Size Font A ANK 12 dots x 24 dots W x H Font B ANK 9 dots x 17 dots W x H Character Baseline Font A At the 21st dot from the top of the character Font B At the 16th dot from the top of the character Default Line Feed Space 30 dots Color Specification First color Page Mode Default Area 360 dots x 831 dots W x H 512 dots x 831 dots W x H Page Mode Maximum Area 360 dots x 1662 dots W x H 512 dots x 1662 dots W x H Barcode UPC A UPC E EAN13 JAN13 EAN8 JAN8 CODES ITF C
9. 125 126 setStatusChangeEventCallback This registers the notification destination of printer status When this API is executed on multiple occasions the notification destination that is specified e This API can be executed following execution of openPrinter p 114 N afterwards is overwritten Syntax public void setStatusChangeEventCallback StatusChangeEventListener target Parameter e target This specifies the object listener interface that has the notification destination method listener registration method If null is soecified for either the method or target the noti fication destination registration is nullified Listener Interface public interface StatusChangeEventListener extends EventListener Listener Registration Method void onStatusChangeEvent String deviceName int status Parameter e deviceName The identifier IPv4 type IP address BD address Device node Printer host name of the device that is notified of printer status is set e status Printer status is set Example public class SampleActivity extends Activity implements OnClickListener StatusChangeEventListener Process private void onStatusChangeEvent String deviceName int status Process private void openPrinter Print printer new Print printer setStatusChangeEventCallback this try printer openPrinter Print DEVTYPE_TCP 192 168 192 168 Print TRUE Print PARAM DEF
10. ePOS Print_SDK_Android_ AppDevGuide_ja_revx pdf Describes the procedure for building a development environment The Japanese language edition The following manuals are available for ePOS Print SDK for Android 1 ePOS Print SDK for Android User s Manual This Document 1 ePOS Print SDK for Android Application Development Setup Guide Sample Program For an Android application for TM printers developed using ePOS Print SDK for Android the following program is available 1 ePOS Print_Sample_Anaroid zip e Basic function sample ePOSPrintSample e Easy Select sample ePOSEasySelectSample Download For customers in North America go to the following web site httpo www epsonexpert com For customers in other countries go to the following web site https download epson biz com service pos Restrictions d A communication API p 53 and command transmission reception API p 159 in the ePOS Print APIs cannot be used for the same device at the same time d A maximum of 16 device ports can be opened in the same application at the same time When the screen display rotates Activity may be discarded To retain a Print instance using Activity closePrinter of the Print class should be called before Activity is discarded A If the device goes into sleep mode while communicating with a printer via Bluetooth the connection will be lost 14 Chapter 2 Sample Program sample Prog
11. ERR_FAILURE An unspecified error occurred e Check the communication settings of the Android device Wi Fi connection setting Bluetooth connection USB connection setting etc e Check that there is no problem with the execution environment Chapter 3 Programming Guide Printer Statuses and Actions to Take Printer statuses vary depending on the TM printer s model This section describes the details of printer statuses and actions to take so that error handling can be performed in your application Action to Take Print ST_NO_RESPONSE Ox00000001 No response from the printer Check the printer status including the power condition and cable and the communication status Print ST_PRINT_SUCCESS Ox00000002 Printing is successfully completed lt Other than TM P20 TM P60 TM P6OIl TM P80 gt Print ST_DRAWER_KICK Ox00000004 Status of the 3rd pin of the drawer kick out connector H lt TM P20 TM P60 TM P6OII TM P80 gt Print ST_BATTERY_OFFLINE Ox00000004 Battery offline status Charge the battery Print ST_OFF_LINE Ox00000008 Offline Eliminate the cause that makes the printer offline Such as cover open and no paper Print ST_COVER_OPEN The cover is open Close the printer s cover Ox00000020 Print ST_PAPER_FEED Paper is being fed by a paper feed g 0x00000040 switch operation Print ST_PANEL_SWITCH The paper feed switch is bei
12. ANK 21 characters Character Size Font A ANK 12 dots x 24 dots W x H Font B ANK 9 dots x 17 dots W x H Kanji font ANK 24 dots x 24 dots W x H Character Baseline Font A At the 21st dot from the top of the character Font B At the 16th dot from the top of the character Kanji font At the 21st dot from the top of the character Default Line Feed Space 30 dots Color Specification First color Page Mode Default Area 576 dots x 1662 dots W x H Page Mode Maximum Area 576 dots x 1662 dots W x H Barcode UPC A UPC E EAN13 JAN13 EAN8 JAN8 CODE39 ITF CODABAR CODE93 CODE128 GS1 128 GS1 DataBar Omnidirectional GS1 DataBar Truncated GS1 DataBar Limited 6S1 DataBar Expanded Two Dimensional Code PDF417 QR Code MaxiCode Data Matrix Aztec Code GS1 DataBar Stacked GS1 DataBar Stacked Omnidirectional GS1 DataBar Expanded Stacked Composite Symbology Paper Cut Feed Drawer Kick Out Not supported Buzzer Optional Battery Supported 180 Only for Traditional Chinese model Appendix Battery Status Upper 8 bits 0x30 The AC adapter is connected 0x31 The AC adapter is connected Lower 8 bits 0x30 Battery amount 0 real end 0x31 Battery amount I nearen SSS 0x32 Battery amount 2 0x33 Battery amount 3 0x34 Battery amount 4 0x35 Battery amount 5 0x36 Battery amount 6 Q If Ox0000 is returned the battery status c
13. Vv Vv TM P80 Wi Fi Vv Vv TM P80 Bluetooth Y Y 12 TM Printer TM U220 Series Wied TAN Bluetooth Vv Vv Vv Interface TM U330 Series Vv Vv Vv In the TM printer settings set only Receive Buffer Full for the Busy Condition NH Regarding the settings see the Technical Reference Guide for the printer Development Environment The following are necessary to develop an Android application e Android SDK r15 or later e Java Development Kit 6 or later Chapter Overview Contents in the Package Package CAN A PE ANNA ePOS Print jar Compiled Java class file archived into a jar format file to allow APIs to be used from Java programs ePOSEasySelect jar A Java class file for selecting a printer easily libeposprint so Library for function execution ARMv5TE supported ePOS Print_Sample_Android zip A sample program file README en txt A readme file README jp txt A readme file The Japanese language edition EULA en txt Contains the SOFTWARE LICENSE AGREEMENT EULA jp txt Contains the SOFTWARE LICENSE AGREEMENT The Japanese language edition ePOS Print_SDK_Android_en_revx pdf This manual ePOS Print_SDK_Anaroid_ja_revx paf The Japanese language edition of this manual ePOS Print_SDK_Android_ AppDevGuide_en_revx pdf Describes the procedure for building a development environment
14. ar gt a T aT Set value Description E 2 lt lt Re E kE 1 ho N r N P y N co E E e 2 2 E el Monochrome Builder MODE_MONO Viviviviviviviviviviviev 2 tone guider MODE CRAIE Multiple tone ASA EEEN e ae 16 tone Builder PARAM_DEFAULT treatment method Specify the half tone Monochrome 2 tone e halftone Specify the half tone treatment method Set value Builder HALFTONE_DITHER Dither This is suitable for graphic printing Builder HALFTONE_ERROR_DIFFUSION Error diffusion This is suitable for mixed printing or charac ters and graphics Builder HALFTONE_THRESHOLD Threshold value This is suitable for printing of characters Builder PARAM_DEFAULT Default value dither selection A In the case of multiple tone 16 tone this is disregarded e brightness Specify the correction value for brightness Set value Actual figure from 0 1 to 10 0 Brightness correction value gamma value Builder PARAM_DEFAULT Select the default value 1 0 A If you specify a value other than 1 0 the printing speed will become slower Chapter 4 API Reference e compress Specifies image compression Specify Builder COMPRESS_DEFLATE only when Bluetooth is selected for the interface TM printer separate setting Set value Description gt a TM U220
15. 15 Usage Environment 16 Development Environment e Android SDK r16 e Java Development Kit 6 e Eclipse e ADT Plugin for Eclipse For details about ways to construct a development environment please refer to the ePOS Print 3 SDK for Android Application Development Setup Guide e TM printer supported in ePOS Print SDK Target device e Device connected to a computer via USB Chapter 2 Sample Program Environmental Construction Follow the procedures below to use the sample program A Extract the sample program zip file to a directory of your choosing 2 In Eclipse go to File Import select General Existing Project into Workspace and then click Next 3 The Import Projects window will be displayed Make the settings shown below and click Finish Specify the directory where you extracted the sample program zip file Select root directory Copy projects into workspace Check this option 4 In the Package Explorer View right click the ePOSPrintSample project or the ePOSEasySelectSample project and then select Properties 5 Properties for ePOSPrintSample or Properties for Properties for ePOSEasySelectSample is displayed Set the following and click OK Android Select the Android OS version of the target device Ensure that a path to ePOS Print jar or ePOS Pairing jar inside Java Build Path the project copied to the project workspace is set in Librar
16. ERR_FAILURE An unspecified error occurred Example To perform feed cut operation try Builder builder new Builder TM T88V Builder MODEL_ANK builder addCut Builder CUT_FEED Process catch EposException e int errStatus e getErrorStatus 102 Chapter 4 API Reference addPulse Adds the drawer kick to the command buffer Sets the drawer kick Not available in page mode Q e The drawer and the buzzer cannot be used together Syntax public void addPulse int drawer int time throws EposException Parameter e drawer Specifies the drawer kick connector Set value Description Builder DRAWER_1 Pin 2 of the drawer kick out connector Builder DRAWER_2 Pin 5 of the drawer kick out connector Builder PARAM_DEFAULT Pin 2 of the drawer kick out connector e time Specifies the ON time of the drawer kick signal Builder PULSE_100 100 ms Builder PULSE_200 200 ms Builder PULSE_300 300 ms Builder PULSE_400 400 ms Builder PULSE_500 500 ms Builder PARAM_DEFAULT 100 ms Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Example To send a 100msec pulse signal to the pin 2 of the drawer kick connector try Builder builder new Builde
17. VIVIVIVI VIVII V V vi vidi ViVi adaTextLineSpace p 60 VIVIiVIi Vivi YV vivi vlv v vivy vivy adaTextRotate p 61 VIVI VIVII V Vivi vi vidi ViVi adaText p 62 VIiVIiVI VI ViVi VviVviVviVviVv4iVv4iVviVviVviVvivVvivVv adaTextLang p 63 VIV I VIVI VI Vi Vi VI ViVi Vivi Uv viv iv v v addTextFont p 64 Yiv v viv vivi v v vi vivi vivy addTextSmooth p 65 Vivo UU UU UU vidi dvi ARAARA addTextDouble p 66 VIV viv iYi ivili vivii vv v addTextSize p 67 VIV I VIVI Up UU iviv v vv viv iv v adaTextStyle p 68 YUU viv viv vv UY viv viv v adaTextPosition p 70 VIV IVI VI vo ViVi Vi VU Uv vv viv iv Vv addFeedunit p 71 Yiv viv UU viv vv Uv viv viv v addFeedLine p 72 VIVIVIVI VI VI VI VI ViVi Vivi viivi addlmage p 73 Yivli v Y V ivi vlv lv vivi vivy addlmage Previous format p 76 YIII vo ViVi Uv UU viv vv vv viv v addlmage Previous format p 79 VIVIVIi ViVi Ue UU Uv UU iv UU viv viv v addLogo p 81 VIV Ii VIVI Up UU ViVi viv iv adaBarcode p 82 Yivli viv Yiv vivii iviviv vv v addSymbol p 87 Y IVV VU UU vv vo vi v v addPageBegin p 92 VIiViVviVvi ViVi vivie viv vivy addPageEnd p 93 VIVIVIVI VI VI VI VI ViVi vv ViVi Vid addPageArea p 94 Yivli viv Yiv ivii vivi vi vv v addPageDirection p 95 YIII ii viviviviv vv v addPagePosition p 97 viv v vivi V Uv iviv viv vV adaPageLine p 98 Vv Viviviv addPageRectangle p 100 Y Y viv iv 1 2
18. 192 168 e MAC address Example 01 23 45 67 89 AB e Printer host name Arbitrary string Print DEVTYPE_BLUETOOTH BD address Example 01 23 45 67 89 AB Print DEVTYPE_USB Device node Q When a printer s IP address is set as DHCP specify a MAC address or printer host name for deviceName When Print DEVTYPE_TCP is selected for deviceType and a printer host name is specified for deviceName use in an environment in which it is possible to search for a printer host name from the DNS server e enabled This specifies whether printer status monitoring is enabled or disabled Specified Value Print TRUE Enabled Print FALSE Disabled Print PARAM_DEFAULT Select default value disabled e interval This specifies the interval in units of milliseconds for updating printer status Specified Value 1000 to 60000 integer Interval for updating printer status in units of millisec onds Print PARAM_DEFAULT Specify the default value 1000 Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_OPEN e The port open process failed e The printer was already in use ERR_ILLEGAL An attempt was made to start communicating with the device with which communication had already started ERR_PROCESSING Could not execute process ERR_MEMORY Could not allocate memory ERR_
19. 37 This is optional checking the printer status For the above procedure refer to Printing After Checking the Printer To ensure successful print operation write a program in such a way that data is sent after Q Status p 39 29 30 Advance Preparations USB Connection For a USB interface we recommend obtaining access permission to USB devices in the application in advance note the following e When OK is pressed in the dialog box for access permission acquisition it takes about 10 seconds to open a port When Cancel is pressed in the dialog box for access permission acquisition the state of waiting for the timeout lasts for 30 seconds 2 To open a port using the openPrinter method without obtaining access permission to USB devices How to obtain access permission in the application is as follows A Add the following code to AndroidManifest xml lt manifest gt lt application gt lt activity gt lt intent filter gt lt action android name android hardware usb action USB_DEVICE_ATTACHED gt lt intent filter gt lt meta data android name android hardware usb action USB_DEVICE_ATTACHED android resource xml device_filter gt lt activity gt lt application gt lt manifest gt 2 Add res xml device_filter xml to the source file 3 Write the following code in the device filter xml file lt xml version 1 0 encoding utf 8
20. API Reference addCommand Adds commands to the command buffer Sends ESC POS commands For information about ESC POS commands see the ESC POS Command Reference NH You can view the ESC POS Command Reference from https reference epson biz com Syntax public void addCommand byte data throws EposException Parameter e data Specifies ESC POS command as a binary data Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Example try Builder builder new Builder TM T88V Builder MODEL_ANK byte data null Process builder addCommand data catch EposException e int errStatus e getErrorStatus 111 Print class Constructor Constructor for the Print class Initializes a Print class instance This constructor is used when using the log output function and when communicating via a USB connection Syntax public Print Context context Parameter e context Specifies the context of the application Example import android content Context Print printer new Print getApplicationContext Process 112 Chapter 4 API Reference Print class Constructor Previous format Constructor for the Print class Initializes a Print class instance The log
21. DF417 error correction leve Builder LEVEL_8 P P P P PDF417 error correc P P P P DF417 error correction level 8 Builder LEVEL_L QR Code error correction level L Builder LEVEL_M QR Code error correction level M Builder LEVEL_Q QR Code error correction level Q Builder LEVEL_H QR Code error correction level H Builder LEVEL_DEFAULT Default level 5 to 95 integer Aztec Code error correction level percent unit Builder PARAM_UNSPECIFIED Retains the current setting Select the level according to the 2D Code type For MaxiCode two dimensional GS1 DataBar DataMatrix select Builder LEVEL_DEFAULT Specifies the module width Set value Integer from 0 to 255 Module width Builder PARAM_UNSPECIFIED Retains the current setting Q MaxiCode is ignored e height Specifies the module height Set value Integer from 0 to 255 Module height Builder PARAM_UNSPECIFIED Retains the current setting NQ QR Code MaxiCode two dimensional GS1 DataBar Aztec Code DataMatrix are ignored Chapter 4 API Reference e size Specifies the 2D Code maximum size Integer from 0 to 65535 2D Code maximum size Builder PARAM_UNSPECIFIED Retains the current setting QR Code MaxiCode Aztec Code DataMatrix are ignored Exceptions When processing fails EposExce
22. Ethernet Wi Fi Bluetooth USB 58 mm 80 mm Resolution ANK 180 dpi x 180 dpi WxH Other 203 dpi x 203 dpi W x H Language e ANK model e Japanese model e Simplified Chinese model e Traditional Chinese model e Korean model e South Asian model Print Width ANK 360 dots Other 416 dots ANK 512 dots Other 576 dots Characters in a Font A ANK 30 characters ANK 42 characters Line Other 34 characters Other 48 characters Font B ANK 40 characters ANK 56 characters Other 52 characters Other 72 characters Character Size Font A 12 dots x 24 dots W x H Font B 9 dots x 17 dots W x H Character Baseline Font A At the 21st dot from the top of the character Font B At the 15th dot from the top of the character Default Line Feed Space Color Specification 30 dots First color Page Mode Default Area ANK 360 dots x 1662 dots WxH Other 416 dots x 1662 dots WxH ANK 512 dots x 1662 dots WxH Other 576 dots x 1662 dots WxH Page Mode Maximum Area ANK 360 dots x 1662 dots WxH Other 416 dots x 1662 dots WxH ANK 512 dots x 1662 dots WxH Other 576 dots x 1662 dots WxH Barcode UPC A UPC E EAN13 JAN13 EAN8 JAN8 CODE339 ITF CODABAR CODE93 CODE128 GS1 128 GS1 DataBar Omnidirectional GS1 DataBar Truncated GS1 DataBar Limited 6S1 DataBar Expanded Two Dimensional Code PDF417 QR Code MaxiCode GS1 DataBar Stacked GS1 Dat
23. Internal Buzzer Builder PATTERN_10 Pattern 10 Internal Buzzer Builder PARAM_DEFAULT Pattern A e repeat Specifies the number of repeats to 255 Number of repeats Builder PARAM_DEFAULT One time 104 Chapter 4 API Reference e cycle This specifies the buzzer sounding cycle in units of milliseconds Set value Description 1000 to 25500 1000 to 25500 milliseconds Builder PARAM_DEFAULT 1000 milliseconds Pattern A to E Error sound pattern Pattern when there is no paper is disregarded Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Example When sounding pattern 1 three times at 1 000 millisecond cycles try Builder builder new Builder TM T88V Builder MODEL_ANK builder addSound Builder PATTERN_1 3 1000 Process catch EposException e int errStatus e getErrorStatus 105 addSound Previous format Adds the turning on of the buzzer to the command buffer Sets the buzzer You cannot set the buzzer sounding cycle If you want to optionally set the buzzer sounding NM cycle milliseconds use addSound p 104 Not available in page mode The buzzer function and the drawer cannot be used together This API function ca
24. P format 165 openPrevieus iman Ihe communications via a USB connection cannot be made close Closes the device port 166 write Send data 167 read Receive data 168 Opens the specified device port Syntax public void open int deviceType String deviceName String devicesettings Context context throws EpsonloException Parameter e deviceType Specifies the device type to open The following values can be specified DevType TCP Specify this when the printer to be opened will connect with Wi Fi Ethernet Devlype BLUETOOTH Specify this when the printer to be opened will connect with Bluetooth DevType USB Specify this when the printer to be opened will connect with USB e deviceName Specifies the identifier to locate the target device The following values can be speci fied deviceType Specified Value DevType TCP One of the following can be specified e Pv4 IP address Example 192 168 192 168 e MAC address Example 01 23 45 67 89 AB e Printer host name Arbitrary string DevType BLUETOOTH BD address Example 01 23 45 67 89 AB DevType USB Device node e deviceSettings Specify null 163 e context Specifies the context of the application deviceType Specified Value DevType TCP null DevType BLUETOOTH null DevType USB context of the application Exceptions When processing fails EpsonloException is throw
25. PARAM UNSPECIFIED builder addBarcode 0201234567890 Builder BARCODE_GS1_DATABAR_ LIMITED Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED builder addBarcode 01 2012345678903 Builder BARCODE_GS1_DATABAR_EXPANDED Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Process catch EposException e int errStatus e getErrorStatus Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED 1 Chapter 4 API Reference addSymbol Adds 2D Code printing to the command buffer Syntax public void addSymbol String data int type int level int width int height int size throws EposException Parameter e data Specifies 2D Code data as a character string 20 Code type Standard PDF417 Convert the character string to the string in UTF 8 apply the escape sequence and then encode the string Truncated PDF417 The data area can contain up to 928 code words in a maximum of 90 rows each of which can contain up to 30 code words QR Code Model 1 Convert the character string to the string in Shift JIS apply the escape sequence and then encode the string based on the data type as shown below Number Oto9 QR Code Model 2 Alphanumeric character Oto9 AtoZ space 4 Kanji character Shift JIS value 8 bit byte data 0x00 to Oxff 87 88 2D Code iype Maxi
26. Programming Guide Transmission of Print Document Send a print document using the Print class 0 53 Create a Print class using the constructor for it use sendData to specify the Builder class instance that stores the command buffers for the print document and send the document The command buffers stored in the Builder class instance will be retained until clearCommancBuffer 0 58 is executed Execute clearCommandBuffer after the success of sendData p 122 If you want to print the same document repeatedly you don t have to execute Q clearComanndBuffer Use the programming example below for your reference Initialize a Print class instance Print printer new Print int status new int 1 status 0 0 try nitialize a Builder class instance Builder builder new Builder TM T88V Builder MODEL_ANK Create a print document lt The page mode starts gt builder addTextLang Builder LANG_ builder addText Smooth Builder TRUE builder addTextFont Builder FONT_A builder addTextSize 4 4 builder addTextStyle Builder FALSE Builder FALS lt Specify the print data gt builder addText Hello t builder addText World n builder addCut Builder CUT_FEED q Builder TRUE Builder PARAM_UNSPECIFIED Send a print document lt Start communication with the printer gt Wi Fi Ethernet device printer openPrinter mList ge
27. addPageEnd Process catch EposException e int errStatus e getErrorStatus 93 94 addPageArea Adds the print area in page mode to the command buffer Specifies the print area in page mode coordinates After this API function specify a print data API function such as the addText method e Specify a print area to cover the content to be printed If the print data extends beyond the print Q area the print result will be such that the print data has been printed incompletely e Use this API function by inserting it between addPageBegin p 92 and addPageEnd p 93 Syntax public void addPageArea int x int y int width int height throws EposException Parameter e x Specifies the origin of the horizontal axis in dots Specifies an integer from O to 65535 0 is the left end of the printer s printable area e y Specifies the origin of the vertical axis in dots Specifies an integer from O to 65535 0 is the position in which no paper feed has been performed e width Specifies the width of the print area in dots Specifies an integer from O to 65535 e height Specifies the height of the print area in dots Specifies an integer from O to 65535 Determine the width and height of the print area according to the print direction setting Otherwise Q the print data might not be printed completely Exceptions When processing fails EposException is thrown with
28. as HRI print characters and are not encoded as data To encode each of the following characters specify two characters starting with the character FNC1 1 C K 0 Aztec Code Full Range mode After converting the character string to UTF 8 conduct the escape sequence and encode Up to 3 067 characters of text 3 832 numerical figures and 1 914 bytes of binary data can be specified Aztec Code Compact mode After converting the character string to UTF 8 conduct the escape sequence and encode Up to 89 characters of text 110 numerical fig ures and 53 bytes of binary data can be speci fied Chapter 4 API Reference 2D Code iype DataMatrix square After converting the character string to UTF 8 DataMatrix rectangle 8 lines conduct the escape sequence and encode DataMatrix rectangle 12 lines The symbol is either a square ranging in size from 10 lines x 10 rows to 144 lines x 144 rows or a rectangle comprising 8 lines 12 lines or 16 lines DataMatrix rectangle 16 lines Up to 2 335 alphanumerical 3 116 numerical figures and 1 556 bytes of binary data can be specified To specify binary data that cannot be represented by character strings use the following escape sequences GEES IA MARE 1 o I xnn Control code Back slash e type Specifies the 2D Code type Builder SYMBOL_PDF417_STANDARD Standard PDF417
29. code Back slash e type Specifies the barcode type Builder BARCODE_UPC_A UPC A Builder BARCODE_UPC_E UPC E Builder BARCODE_EAN13 EAN13 Builder BARCODE_JAN13 JAN13 Builder BARCODE_EAN8 EAN8 Builder BARCODE_JAN8 JAN8 Builder BARCODE_CODE39 CODE39 Builder BARCODE_ITF ITF Builder BARCODE_CODABAR CODABAR Builder BARCODE_CODE93 CODE93 Builder BARCODE_CODE128 CODE128 Builder BARCODE_6S1_128 6S1 128 Builder BARCODE_GS1_DATABAR_OMNIDIRECTIONAL GS1 DataBar Omnidirectional Builder BARCODE_GS1_DATABAR_TRUNCATED GS1 DataBar Truncated Builder BARCODE_GS1_DATABAR_LIMITED GS1 DataBar Limited Builder BARCODE_GS1_DATABAR_EXPANDED GS1 DataBar Expanded e hri Specifies the HRI position Set value Description Builder HRI_NONE default HRI not printed Builder HRILABOVE Above the barcode Builder HRI_BELOW Below the barcode Builder HRI_BOTH Both above and below the barcode Builder PARAM_UNSPECIFIED Retains the current setting e font Specifies the HRI font Builder FONT_A default Font A Builder FONT_B Font B Builder FONT_C Font C Builder FONT_D Font D Builder FONT_E Font E Builder PARAM_UNSPECIFIED Retains the current setting e width Specifies the width of each module in dots Specifies an integer from 2 to 6 Set value Integer from 1 to 6 Description The width of each module Unit dot Builder PARAM_UNSPECIFIED Retains the current setting 84 Chapter 4 API Reference e height Specifies the barcode h
30. destination that is specified e This API can be executed following execution of openPrinter p 114 Q afterwards is overwritten Syntax public void setDrawerOpenEventCallback DrawerOpenEventListener target Parameter e target This specifies the object listener interface that has the notification destination method listener registration method If null is specified for either the method or target the noti fication destination registration is nullified Listener Interface public interface DrawerOpenEventListener extends EventListener Listener Registration Method void onDrawerOpenEvent String deviceName Parameter e deviceName The identifier IPv4 type IP address BD address Device node Printer host name of the device that is notified of drawer open event is set Example public class SampleActivity extends Activity implements OnClickListener DrawerOpenEventListener Process private void onDrawerOpenEvent String deviceName Process private void openPrinter Print printer new Print printer setDrawerOpenEventCallback this try printer openPrinter Print DEVTYPE_TCP 192 168 192 168 Print TRUE Print PARAM DEFAULT Process catch EposException e int errStatus e getErrorStatus Chapter 4 API Reference setBatteryLowEventCallback This registers the notification destination of a battery low event This re
31. do specifying the print direction in 05 Ir N Adds a tag for specifying the print position in 97 page mode addPageLine Adds a tag for drawing a line in page mode 98 sg EPs EE Adds a tag for drawing a rectangle in page 100 mode Cut addCut Adds a tag for paper cut 102 Drawer kick out addPulse Adds a tag for the drawer kick out 103 addSound Adds a tag for turning on the buzzer 104 Buzzer addSound Adds a tag for turning on the buzzer 106 Previous format The buzzer sounding cycle cannot be set Paper Layout addLayout Adas a tag for paper layout information 109 Send Command addCommand Adds a tag for inserting commands 111 52 Chapter 4 API Reference Print class Controls the printer by sending a print document created using the Builder class and monitors the transmission result and the communication status Initialize a Print class instance E Constructor 112 This constructor is for the log output function Initialize a Print class instance Constructor Previous format The log output function cannot be used and communica 113 tions via a USB connection cannot be made Starts communications with the printer and monitoring of Ope Arnish the printer status Starts communications with the printer and monitoring of openPrinter Previous format the printer status 116 Timeout cannot be set f Start communication with the printer openPrinter Previous format ae 119 The printer stat
32. e APIIO Interface layer called by the application e IOCM DEVIO Layer for communication with devices Direction in which data is input and output Input tput direc nput and output direc e gt Input from a layer tion e lt Output from a layer Input and output data Called API parameter and communication data 2 Each item is separated by a comma Output example To call the addcut method from the application 2014 07 28 20 12 35 836 00002ae9 00006008 APIIO gt 0x687bc5d8 addCut 1 2014 07 28 20 12 35 836 00002ae9 00006008 APITO lt 0x687bc5d8 0 addCut 157 158 Chapter5 Command Transmission Reception Command Transmission Reception This chapter describes APIs for transmission and reception of commands ESC POS commands etc The APIs for command transmission and reception described in this chapter are intended for NM customers who understand ESC POS commands very well A command transmission reception API cannot be used with the Print class p 53 of ePOS Print S API Programming Programming Flow Perform programming following this flow 1 Advance Preparations USB Connection p 30 2 Printer Selection p 31 lt Select printer using NFC gt lt Select printer using QR code gt 3 Opening a Device Port p 160 4 Sending Data p 160 5 Receiving Data p 161 6 Closing the Device Port p 161 This is optional lt Se
33. font setting 64 Text addTextSmooth Adas a tag for the text smoothing setting 65 A tag f ifying th le si text addtexiDoubls das a tag for specifying the double sized tex 66 setting addtTextSize Adds a tag for the text scale setting 67 adaTextStyle Adds a tag for the text style setting 68 de Postion Adds a tag for specifying the print position of 70 text addFeedunit Adds a tag for paper feeding in dots 71 Paper Feed addFeedLine Adds a tag for paper feeding in lines 72 addFeecPosition Adds a tag for label black mark paper feeding 108 51 AP Adds multiple tone raster image printing to the ass command oe 73 Compresses image data and adds them to the command buffer Bluetooth interface Adds multiple tone raster image printing to the addlmage command buffer 5 Graphic Previous format Image data compression cannot be used Bluetooth interface Adds a tag for a raster image to be printed addlmage Image data compression cannot be used 79 Previous format Bluetooth interface Multiple tones cannot be printed addLogo Adds a tag for an NV logo to be printed 81 ASS addBarcode Adds a tag for a barcode to be printed 82 addSymbol Adds a tag for a 2D Code to be printed 87 addPageBegin Adds a tag for switching to page mode 92 addPageEnd Adds a tag for finishing page mode 93 creian Adds a tag for specifying the print area in page 94 mode ence addPageDirection
34. for Bluetooth Return value Returns the result of NFC analysis Stores it into an EasySelectinfo class instance If analysis fails returns null Analyzes AR code string data Syntax public EasySelectIinfo parseQR String data Parameter e data Specifies AR code string data Return value Returns the result of QR code string data analysis Stores it into an EasySelectinfo class instance If analysis fails returns null 151 152 Creates AR code print data for Easy Select Syntax public String createQR String printerName int deviceType String macAddress Parameter e printerName Specifies the printer name e devicelype Specifies the device type Set either of the following Print DEVTYPE_TCP Wi Fi Ethernet device Print DEVTYPE_BLUETOOTH Bluetooth device e macAddress Specifies the BD address BD addresses support the following formats Description 00 11 22 33 44 55 Separated by a colon 00 11 22 33 44 55 Separated by a hyphen 001122334455 Not separated Return value Returns QR code print data for Easy Select If print data creation fails returns null Chapter 4 API Reference deviceType Stores the device type in the analysis result Stored data Print DEVTYPE_TCP Print DEVTYPE_BLUETOOTH Description Wi Fi Ethernet device NFC standard specification for Bluetooth Format int deviceType Stores the printer n
35. getResult Previous format EpsonloException class This class notifies you of the exception error value that occurred during the API calling of the Finder class and the Epsonlo class p 163 The following APIs are available getStatus Acquires an error value of an exception 149 143 Starts a search for printers of the specified device type If you use this API be sure to use stop p 145 to stop the search A NQ You cannot call this API when a printer search is already in progress Syntax public Parameter e context e devicelype e findOption Exceptions static synchronized void start Context context int deviceType String findOption throws EpsonloException Set a Context class instance of caller Example Set the Context acquired by getBaseContext in Activity Specifies the device type to search for The following values can be specified deviceType Description DevType TCP Searches for TM devices connected to the network Searches for Bluetooth devices that have a device class of Printer or Uncategorized Searches for USB devices from the PID and VID DevType USB Search condition DevType BLUETOOTH Searches for TM device connected to the USB Specifies the setting value when searching for a specific target device deviceType Setting Value DevType TCP The broadcast address to search for DevType BLUETOOTH null DevType USB null
36. gt lt resources gt lt usb device vendor id 1208 gt lt resources gt 4 A dialog box appears when obtaining access permission Press OK Chapter 3 Programming Guide Printer Selection Selecting a printer using the search function Use the Finder class s start p 144 to start searching for printers Please refer to the following code int errStatus IoStatus SUCCESS Start search try switch deviceType Wi Fi Ethernet device case DevType TCP Finder start getBaseContext DevType TCP 255 255 255 255 break Bluetooth device case DevType BLUETOOTH Finder start getBaseContext DevType BLUETOOTH null break USB device case DevType USB Finder start getBaseContext DevType USB null break default Finder start getBaseContext DevType TCP 255 255 255 255 break Exception handling catch EpsonIoException e errStatus e getStatus Getting the printer search result Use the Finder class s getDeviceinfolist 0 146 to get the result of the printer search Please refer to the following code Use the obtained results in openPrinter p 114 int errStatus ToStatus SUCCESS DeviceInfo mList null Get device list try mList getDeviceInfoList FilterOption PARAM DEFAULT Exception handling catch EpsonIoException e errStatus e getStatus Since
37. number of item code digits varies depending on the manu facturer code Specify Os in empty digits EAN13 When an 11 digit number is specified a check digit is auto matically added JAN13 When a 12 digit number is specified the 12th digit is pro cessed as a check digit but the check digit is not validated EAN8 When a 7 digit number is specified a check digit is auto matically added JAN8 When an 8 digit number is specified the 8th digit is pro cessed as a check digit but the check digit is not validated When the first character is the character is processed as CODE39 the start character In other cases a start character is auto matically added Te Start and stop codes are automatically added Check digits are not added or validated Specify a start character A to D a to d CODABAR Specify a stop character A to D a to d Check digits are not added or validated Start and stop characters are automatically added CODE93 A check digit is automatically calculated and added Barcode type Chapter 4 API Reference Description Specify a start character CODE A CODE B CODE C A stop character is automatically added A check digit is automatically calculated and added To encode each of the following characters specify two characters starting with the character FNC1 1 FNC2 2 CODE128 ENC3 3 FNCA 4 CODE A A CODE B B CODE C C SHIFT S A start c
38. one of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred 79 Example try Bitmap imageData null Builder builder new Builder TM T88V Builder MODEL_ANK Process builder addImage imageData 0 0 256 256 Builder PARAM DEFAULT Process catch EposException e int errStatus e getErrorStatus To print an image 256 dots wide and 256 dots high in page mode try Bitmap imageData null Builder builder new Builder TM T88V Builder MODEL_ANK Process builder addPageBegin builder addPagePosition 0 255 builder addImage imageData 0 0 256 256 Builder PARAM DEFAULT builder addPageEnd Process catch EposException e int errStatus e getErrorStatus Chapter 4 API Reference addLogo Adds NV logo printing to the command buffer Prints a logo registered in the NV memory of the printer e Register a logo in advance into the printer using the following utilities Q Model dedicated Utility TM Flash Logo Setup Utility Multiple tone printing is not supported in Page Mode Multiple tone graphic printing is supported in Standard Mode only Syntax public void addLogo int keyl int key2 throws EposException Parameter e key Specifies the key code 1 of an NV logo S
39. or target the noti fication destination registration is nullified Listener Interface public interface PaperNearEndEventListener extends EventListener Listener Registration Method void onPaperNearEndEvent String deviceName Parameter e deviceName The identifier IPv4 type IP address BD address Device node Printer host name of the device that is notified of paper near end event is set Example public class SampleActivity extends Activity implements OnClickListener PaperNearEndEventListener Process private void onPaperNearEndEvent String deviceName Process private void openPrinter Print printer new Print printer setPaperNearEndEventCallback this try printer openPrinter Print DEVTYPE_TCP 192 168 192 168 Print TRUE Print PARAM DEFAULT Process catch EposException e int errStatus e getErrorStatus 133 134 setPaperEndEventCallback This registers the notification destination of paper end events This refers to events that are notified when printer status indicates there is no paper When this API is executed on multiple occasions the notification destination that is specified e This API can be executed following execution of openPrinter p 114 Q afterwards is overwritten Syntax public void setPaperEndEventCallback PaperEndEventListener target Parameter e target This specifies the object lis
40. output function cannot be used and communications via a USB connection cannot be made Use Print class Constructor p 112 when using the log output function and when Q communicating via a USB connection Syntax public Print Example Print printer new Print Process 113 This starts communications with the printer and monitoring of printer status if communication with the printer is not required anymore be sure to call closePrinter p 121 closePrinter API to end communication with the printer For details see Automatic Acquisition of Printer Status p 41 e If you want to stop monitoring of printer status call closePrinter p 121 If you use the printer from multiple mobile terminals see the Cautions p 190 2 e Printer status is notified to the events registered in the print class Syntax public void openPrinter int deviceType String deviceName int enabled int interval int Parameter timeout throws EposException e devicelype Specifies the type for the device to start communication Set value Print DEVTYPE_TCP Wi Fi Ethernet device Print DEVTYPE_BLUETOOTH Bluetooth device Print DEVTYPE_USB USB device e deviceName Specifies the identifier used for identification of the target device Specifies the following for each device type deviceType Specified Value Print DEVTYPE_TCP One of the following can
41. passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Example To enable smoothing try a Builder builder new Builder TM T88V Builder MODEL_ANK builder addTextSmooth Builder TRUE Process catch EposException e int errStatus e getErrorStatus 65 addTextDouble Adds the double sized text setting to the command buffer Syntax public void addTextDouble int dw int dh throws EposException Parameter e dw Specifies the double sized width Set value Description Builder TRUE Specifies the double sized width Builder FALSE default Cancels the double sized width a ai Retains the current setting e dh Specifies the double sized height Builder TRUE Specifies the double sized height Builder FALSE default D Cancels the double sized height Builder PARAM_UNSPECIFIE Retains the current setting Q When Builder true or 1 is set for both the dw and dh parameters double width and height characters are printed Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Example To set the size as double width and height try Builder builder new Builder TM T88V builder addTextDouble B
42. string Specify the left end of the baseline for the first character This can be omitted for left aligned printing of standard sized characters To print double sized height characters specify a value equal to or greater than 42 for y To print a barcode Specify the bottom left of the symbol And specify the barcode height for y To print a graphic logo Specify the bottom left of the graphic data And specify the graphic data height for y A To print a 2D Code Specify the top left of the symbol This can be omitted when printing from the top left Q Specify the print start position coordinates according to the content to be printed Refer to the Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Example To specify 50 30 for the print start position in the area specified by the addPageArea method and print the characters ABCDE try Builder builder new Builder TM T88V Builder MODEL_ANK builder addPageBegin builder addPageArea 100 50 200 100 builder addPagePosition 50 30 builder addText ABCDE builder addPageEnd Process catch EposException e int errStatus e getErrorStatus 97 98 addPageLine Adas line drawing in page mode to the command buffer Dr
43. to device interface the Android OS may ERR_CONNECT lt Example gt automatically establish connection Failed to send the data to the printer again Try to acquire the status for 20 seconds Then if ERR_CONNECT is still received continuously restore the communication between the Android device and the printer The specified timeout time was exceeded Check the timeout time ERR_TIMEOUT lt Example gt Set a value for the timeout time longer Could not transmit all the data in the than the time required for printing specified time ERR_MEMORY a a iy End the unneeded applications memory for processing Illegal method used lt Example gt e When the printer was not opened an API for sending a command to the Use the API in a proper way ERR_ILLEGAL A i printer was called Refer to Programming Flow p 29 e When attempting to connect via USB a constructor with a context parameter was not used 47 48 ERR_PROCESSING Could not execute process lt Example gt Could not execute the process because an identical process is being executed in another thread Review the application processing timing so that processes do not overlap each other ERR_UNSUPPORTED An unsupported model name or language specification was specified Cannot be used for unsupported models ERR_OFF_LINE The printer is offline Eliminate the cause that makes the printer offline Such as cover open and no paper
44. void addLayout int type int width int height int marginTop int marginBottom int offsetCut int offsetLabel throws EposException Parameter e type Specifies the paper type Builder LAYOUT_RECEIPT Receipt paper no black mark Builder LAYOUT_LABEL Label paper no black mark Builder LAYOUT_LABEL_BM Label paper with black mark Builder LAYOUT_RECEIPT_BM Receipt paper with black mark e width Specifies paper width in units of 0 1 mm Specifies an integer from 1 to 10000 e height Specifies the distance in units of 0 1 mm from the standard printing position to the next standard printing position Specifies an integer from O to 10000 If O is specified the distance from the standard printing position to the next standard printing position is detected automatically e marginTop Specifies the distance in units of 0 1 mm from the standard printing position to the top position Specifies an integer from 9999 to 10000 e marginBottom Specifies the distance in units of 0 1 mm from the standard eject position to the bot tom edge of the printable area Specifies an integer from 9999 to 10000 e offsetCut Specifies the distance in units of 0 1 mm from the standard eject position to the cut ting position Specifies an integer from 9999 to 10000 e offsetLabel Specifies the distance in units of 0 1 mm from the standard eject position to the bot tom edge of the label Specifies an integer from O
45. 1 dots W x H Page Mode Maximum Area 360 dots x 1662 dots W x H 512 dots x 1662 dots W x H Barcode UPC A UPC E EAN13 JAN13 EAN8 JAN8 CODE39 ITF CODABAR CODE93 CODE128 GS1 128 GS1 DataBar Omnidirectional 6S1 DataBar Truncated GS1 DataBar Limited GS1 DataBar Expanded Two Dimensional Code PDF417 QR Code MaxiCode 6S1 DataBar Stacked GS1 DataBar Stacked Omnidirectional GS1 DataBar Expanded Stacked Composite Symbology Paper Cut Cut Feed cut Drawer Kick Out Supported Buzzer Optional Battery Not supported 189 Cautions If you Use the Printer from Multiple Mobile Terminals If you use the printer from multiple mobile terminals while you are using a particular terminal it will not be possible to print from the other ones With Version 1 6 0 and later if openPrinter processing has been initiated on one terminal when the printer is being used by another terminal the openPrinter processing will wait for the other terminal s processing to end The chart below shows the flow of processing when a single printer is used from mobile terminal A and mobile terminal B Version 1 5 0 and earlier With Version 1 5 0 and earlier mobile terminal B will wait for mobile terminal A s closePrinter processing to end before executing sendData processing POS Print Mobile terminal A e Ea Mobile terminal B f 1 op
46. 2
47. A Select the 2D Code type using Type 2 Enter the 2D Code data for Data 3 Set the following for each 2D Code Error Correction Level PDF417 QR Code Aztec Code DataMatrix Set the error correction level Module Size Width Height Set the 2D Code module size width height Max Size Set the maximum 2D Code size 4 Tap Print to print 21 22 Printing in page mode Execute the printing in page mode according to the following procedure A Enter a string to print for Print Characters 2 Set the print area using Print Area Description X Set the origin of horizontal axis Y Set the origin of vertical axis Width Set the width for the print area Height Set the height for the print area 3 Tap Print to print Paper cutting Execute the paper cutting according to the following procedure A Set whether to cut after feeding paper using Type 2 Tap Print and execute cutting operation Log output setting Use the following procedures A Set whether to enable the log output function and the log output destination in Enabled 2 Set the following items according to the log output destination Description IP Address Specify the IP address for TCP communication Port Specify the port number for TCP communication Log Size SPECI the maximum size of log data that can be saved on the device s storage Log Level Set the level of log
48. AN p 121 closePrinter API to end communication with the printer The timeout time for this API cannot be set If you want to set the timeout time for this 3 API use openPrinter p 114 e Printer status is notified to the events registered in the print class For details see Automatic Acquisition of Printer Status p 41 e If you want to stop monitoring of printer status call closePrinter p 121 If another application opened the printer depending on the connection method care should be taken about the following TCP connection Retry this API for 15 seconds After 15 seconds ERR_OPEN will be returned Bluetooth connection When an attempt is made to start communication using this API its result may not be returned e If you use the printer from multiple mobile terminals see the Cautions p 190 Syntax public void openPrinter int deviceType String deviceName int enabled int interval throws EposException Parameter e deviceType Specifies the type for the device to start communication Print DEVTYPE_TCP Wi Fi Ethernet device Print DEVTYPE_BLUETOOTH Bluetooth device Print DEVTYPE_USB USB device Chapter 4 API Reference e deviceName Specifies the identifier used for identification of the target device Specifies the following for each device type deviceType Specified Value Print DEVTYPE_TCP One of the following can be specified e Pv4 IP address Example 192 168
49. AULT Process catch EposException e int errStatus e getErrorStatus Chapter 4 API Reference setOnlineEventCallback This registers the notification destination of online events This refers to events that are notified when printer status is online When this API is executed on multiple occasions the notification destination that is specified This API can be executed following execution of openPrinter p 114 Q afterwards is overwritten Syntax public void setOnlineEventCallback OnlineEventListener target Parameter e target This specifies the object listener interface that has the notification destination method listener registration method If null is specified for either the method or target the noti fication destination registration is nullified Listener Interface public interface OnlineEventListener extends EventListener Listener Registration Method void onOnlineEvent String deviceName Parameter e deviceName The identifier IPv4 type IP address BD address Device node Printer host name of the device that is notified of online event is set Example public class SampleActivity extends Activity implements OnClickListener OnlineEventListener Process private void onOnlineEvent String deviceName Process private void openPrinter Print printer new Print printer setOnlineEventCallback this try pr
50. Builder SYMBOL_PDF417_TRUNCATED Truncated PDF417 Builder SYMBOL_QRCODE_MODEL_1 QR Code Model 1 Builder SYMBOL_QRCODE_MODEL_2 QR Code Model 2 Builder SYMBOL_MAXICODE_MODE_2 MaxiCode Mode 2 Builder SYMBOL_MAXICODE_MODE_3 MaxiCode Mode 3 Builder SYMBOL_MAXICODE_MODE_4 MaxiCode Mode 4 Builder SYMBOL_MAXICODE_MODE_5 MaxiCode Mode 5 Builder SYMBOL_MAXICODE_MODE_6 MaxiCode Mode 6 Builder SYMBOL_GS1_DATABAR_STACKED GS1 DataBar Stacked Builder SYMBOL_GS1_DATABAR_STACKED_OM_ GS1 DataBar Stacked NIDIRECTIONAL Omnidirectional ee ee eee eon sales Sos dea Builder SYMBOL_AZTECCODE_FULLRANGE Aztec Code Full Range mode Builder S MBOL_AZTECCODE_COMPACT Aztec Code Compact mode Builder S MBOL_DATAMATRIX_SQUARE DataMatrix square Builder S MBOL_DATAMATRIX_RECTANGLE_8 DataMatrix rectangle 8 lines Builder SYMBOL_DATAMATRIX_RECTANGLE_12 DataMatrix rectangle 12 lines Builder SYMBOL_DATAMATRIX_RECTANGLE_16 DataMatrix rectangle 16 lines 89 90 e level e width Specifies the error correction level Set value Builder LEVEL_O Description DF417 error correction leve Builder LEVEL_1 DF417 error correction leve Builder LEVEL_2 DF417 error correction leve Builder LEVEL_3 DF417 error correction leve Builder LEVEL_4 Builder LEVEL_5 DF417 error correction leve Builder LEVEL_6 DF417 error correction leve Builder LEVEL_7 0 1 2 3 ion level 4 5 6 7
51. Code Mode 2 MaxiCode Mode 3 MaxiCode Mode 4 MaxiCode Mode 5 MaxiCode Mode 6 Convert the character string to the string in UTF 8 apply the escape sequence and then encode the string In Modes 2 and 3 when the first piece of data is 0 gt 1x1e011x1dyy where yy is a two digit num ber this is processed as the message header and the subsequent data is processed as the primary message In other cases from the first piece of data data is processed as the primary message In Mode 2 specify the primary message in the following format Postal code 1 to 9 digit number GS x1d ISO country code 1 to 3 digit number GS x1d Service class code 1 to 3 digit number In Mode 3 specify the primary message in the following format Postal code 1 to 6 pieces of data convertible by Code Set A GS x1d ISO country code 1 to 3 digit number GS x1d Service class code Cl to 3 digit number GS1 DataBar Stacked GS1 DataBar Stacked Omnidirectional Convert the character string to the string in UTF 8 apply the escape sequence and then encode the string Specify a 13 digit global trade item number GTIN not including an application identifier Al or a check digit GS1 DataBar Expanded Stacked Convert the character string to the string in UTF 8 apply the escape sequence and then encode the string You can enclose an application identifier Al in parentheses The parentheses are used
52. EPSON EXCEED YOUR VISION ePOS Print SDK tor Android User s Manual Overview Describes the features and development environment Sample Program Describes how to use the sample program Programming Guide Describes how to write programs in application development API Reference Describes the APIs provided in ePOS Print SDK for Android Command Transmission Reception Describes the APIs for transmitting and receiving commands Appendix Describes the specifications for printers used for the ePOS Print SDK for Android M000489 10 Rev K 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 e 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 una
53. ER Process catch EposException e int errStatus e getErrorStatus 59 60 addTextLineSpace Adds the line feed space setting to the command buffer Syntax public void addTextLineSpace int linespc throws EposException Parameter e linespc Specifies the line feed space in dots Specifies an integer from O to 255 Default value Refer to Support Information by Printer p 170 Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Example To set the line feed space to 30 dots try Builder builder new Builder TM T88V Builder MODEL_ANK builder addTextLineSpace 30 Process catch EposException e int errStatus e getErrorStatus Chapter 4 API Reference addTextRotate Adas the text rotation setting to the command buffer This API setting also applies to barcodes two dimensional symbols Q e When the page mode is selected for the print mode to set text rotation use the addPageDirection p 95 instead of this API function Syntax public void addTextRotate int rotate throws EposException Parameter e rotate Specifies whether to rotate text Builder TRUE Specifies rotated printing of text Builder FALSE default Can
54. FAILURE An unspecified error occurred 117 Example Case where printer status monitoring is enabled and communications are commenced using Wi Fi Ethernet and a printer with an IP address of 192 168 192 168 Print printer new Print try printer openPrinter Print DEVTYPE_TCP 192 168 192 168 Print TRUE Print PARAM DEFAULT Process catch EposException e int errStatus e getErrorStatus 118 Chapter 4 API Reference openPrinter Previous format Starts communication with the printer Printer status cannot be acquired if communication with the printer is not required anymore be sure to call closePrinter NM p 121 closePrinter API to end communication with the printer The timeout time for this API cannot be set If you want to set the timeout time for this Q API use openPrinter p 114 e If you want to automatically acquire the printer status use openPrinter p 114 e If another application opened the printer depending on the connection method care should be taken about the following TCP connection Retry this API for 15 seconds After 15 seconds ERR_OPEN will be returned Bluetooth connection When an attempt is made to start communication using this API its result may not be returned e Ifyou use the printer from multiple mobile terminals see the Cautions p 190 Syntax public void openPrinter int deviceType String deviceName throws E
55. GS1 DataBar Expanded Two Dimensional Code PDF417 QR Code MaxiCode 6S1 DataBar Stacked GS1 DataBar Stacked Omnidirectional GS1 DataBar Expanded Stacked Composite Symbology Paper Cut Cut Feed cut Drawer Kick Out Supported Buzzer Optional Battery Not supported 185 TM T8111 80 mm Interface Ethernet USB Resolution 203 dpi x 203 dpi W x H Language Simplified Chinese model Print Width 576 dots Characters in a Line Font A ANK 48 characters Font B ANK 64 characters Character Size Font A ANK 12 dots x 24 dots W x H Font B ANK 9 dots x 17 dots W x H Character Baseline Font A At the 21st dot from the top of the character Font B At the 16th dot from the top of the character Default Line Feed Space 30 dots Color Specification First color Page Mode Default Area 576 dots x 831 dots W x H Page Mode Maximum Area 576 dots x 1662 dots W x H Barcode UPC A UPC E EAN13 JAN13 EAN8 JAN8 CODE39 ITF CODABAR CODE93 CODE128 Two Dimensional Code PDF417 QR Code Paper Cut Cut Feed cut Drawer Kick Out Supported Buzzer Not supported Battery Not supported 186 Appendix TM T82 58 mm 80 mm Interface Ethernet USB Resolution 203 dpi x 203 dpi W x H Language e Simplified Chinese model e South Asian model Print Width 420 dots 576 dots Characters in a Line Font A ANK 35 characte
56. INE Print ST_OFF_LINE 5 tee i lt End communication with the printer gt printer closePrinter catch EposException el int errStatusl el getErrorStatus status 0 el getPrinterStatus if errStatusl EposException ERR_CONNECT try lt End communication with the printer gt printer closePrinter lt Start communication with the printer gt 6 printer openPrinter Print DEVTYPE_TCP 192 168 192 168 lt Send print data gt printer sendData builder 10000 status lt End communication with the printer gt printer closePrinter catch EposException e2 int errStatus2 e2 getErrorStatus status 0 e2 getPrinterStatus 39 40 ao DBOQN Create print data To check the printer status send empty print data Send the print data created in 2 If the print data created in 2 was properly sent and the printer is online then send the print data created in 1 If the print data created in 2 was properly sent and the printer is offline eliminate the cause that makes the printer offline Such as cover open and no paper If the print data created in 2 was not properly sent stop communicating with the printer restart communicating with the printer again and then send the print data Chapter 3 Programming Guide Automatic Acquisition of Printer Status In ePOS Print SDK listener is used to automati
57. Invalid parameter was passed loStatus ERR_MEMORY Could not allocate the necessary memory for processing loStatus ERR_ILLEGAL Illegal method used loStatus ERR_PROCESSING Could not execute process loStatus ERR_FAILURE An unspecified error occurred 149 Printer Easy Select API The Printer Easy Select APIs are APIs for selecting a printer using NFC or AR Code They convert data obtained from NFC or AR code to a format that can be passed to openPrinter The following classes are available T EasySelect class p 150 11 EasySelectinfo class p 150 EasySelect class Analyzes NFC data and QR code data The following APIs are available parseNFC Analyzes NFC tag data 15 parseQR Analyzes QR code data 151 createQR Creates QR code print data for Easy Select 152 EasySelectinfo class This class stores data analyzed by an EasySelect class instance and converts it into a variable to be passed to openPrinter The following member variables are available Member Variable deviceType Device type in the analysis result 183 printerName Printer name in the analysis result 138 macAddress MAC address or BD address in the analysis result 153 150 Chapter 4 API Reference parseNFC Analyzes NFC tag data Syntax public EasySelectIinfo parseNFC Tag tag Parameter e tag Specifies NFC tag data Wi Fi data Locally defined data for Wi Fi BTSSP NFC standard specification
58. NRECOVER_ERR An unrecoverable error occurred AUTORECOVER_ERR An automatically recoverable error occurred RECEIPT_NEAR_END No paper in roll paper near end sensor RECEIPT_END No paper in roll paper end sensor BUZZER Buzzer is sounding compatible devices only e Battery Status The following will be displayed Sting displayed Oxnnnn Battery status value For details refer to Battery Status p 50 23 24 Method API execution error Any of the following will be displayed e Error Code Any of the following statuses will be displayed Siring displayed ERR_PARAM An invalid parameter was passed ERR_OPEN The open process failed ERR CONNECT Failed to connect to the device ERR_TIMEOUT All data couldn t be sent during the specified time ERR_MEMORY Could not secure the memory required for the process ERR_ILLEGAL Used in an illegal manner ERR_PROCESSING Failed to execute the process ERR_UNSUPPORTED An unsupported model or language of use has been specified ERR _OFF_LINE Printer is offline ERR_FAILURE Another error occurred e Method The API in which a method execution error occurred is displayed Chapter 2 Sample Program Acquisition of Printer Model Name Q A command transmission reception API is used for acquisition of printer model name For details refer to Command Transmission Reception p 159 Use the followi
59. NSPECIFIED new Builder TM Builder PARAM UNSPECIFIED 2 builder addBarcode 01 201234567890 T88V Builder MODEL_ANK Builder BARCODE_UPC_A 64 Builder BARCODE_UPC_E Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder BARCODE_EAN13 Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder BARCODE_JAN13 Builder PARAM UNSPECIFIED Builder PARAM_ UNSPECIFIED Builder BARCODE_EAN8 Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder BARCODE_JAN8 Builder PARAM UNSPECIFIED Builder PARAM_ UNSPECIFIED Builder BARCODE_CODE39 Builder PARAM UNSPECIFIED Builder PARAM_ UNSPECIFIED Builder BARCODE_ITF Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder BARCODE_CODABAR Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder BARCODE_CODE93 Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder BARCODE_CODE128 Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder BARCODE GS1 128 Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED builder addBarcode 0201234567890 Builder BARCODE_GS1 DATABAR OMNIDIRECTIONAL Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED builder addBarcode 0201234567890 Builder BARCODE_GS1 DATABAR TRUNCATED Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder
60. ODABAR CODE93 CODE128 GS1 128 GS1 DataBar Omnidirectional GS1 DataBar Truncated GS1 DataBar Limited 6S1 DataBar Expanded Two Dimensional Code PDF417 AR Code MaxiCode GS1 DataBar Stacked 6S1 DataBar Stacked Omnidirectional GS1 DataBar Expanded Stacked Composite Symbology not supported Paper Cut Cut Feed cut Drawer Kick Out Supported Buzzer Optional Battery Not Supported 170 Appendix TM T70 80 mm Interface Ethernet Wi Fi USB Resolution 180 dpi x 180 dpi W x H Language e ANK model e Japanese model e Simplified Chinese model e Traditional Chinese model e South Asian model Print Width 512 dots Characters in a Line Font A ANK 42 characters Font B ANK 56 characters Character Size Font A ANK 12 dots x 24 dots W x H Font B ANK 9 dots x 17 dots W x H Character Baseline Font A At the 21st dot from the top of the character Font B At the 15th dot from the top of the character Default Line Feed Space 30 dots Color Specification First color Page Mode Default Area 512 dots x 1662 dots W x H Page Mode Maximum Area 512 dots x 1662 dots W x H Barcode UPC A UPC E EAN13 JAN13 EAN8 JAN8 CODESO ITF CODABAR CODE93 CODE128 Two Dimensional Code QR Code Paper Cut Cut Feed cut Drawer Kick Out Supported Buzzer Not supported Battery Not supported 171 TM T7Oll Interface
61. ON the status monitoring interval is set in units of millisec onds Tap Open 18 Chapter 2 Sample Program Y Execute the following processes Process Description Tap Text on the main screen Jom pantind For details refer to Text printing p 20 Tap Image on the main screen Sfapnie printing For details refer to Graphic printing p 20 Tap Barcode on the main screen paicode piling For details refer to Barcode printing p 21 Tap 2D Code on the main screen a ES For details refer to 2D Code printing p 21 Tap Page Mode on the main screen PI A PROSTOR For details refer to Printing in page mode p 22 Tap Cut on the main screen P tti Cee eae For details refer to Paper cutting p 22 Tap Log Settings on the main screen peg Seipubse ting For details refer to Log output setting p 22 Printer status acquisition Tap Get Status on the main screen 8 The following execution results will be displayed e Process execution result error status printer status battery status For details refer to Process execution result 0 23 e Method API execution error For details refer to Method API execution error p 24 When all processing is finished tap Close on the main screen and close the printer s port 19 20 Text printing Execute the text printing according to the following procedure A Enter a string to print fo
62. P20 TM P20 TM P60 TM P60 TM P6OII TM P60Il TM P80 TM P80 TM T20 TM 120 TM T20II TM T20I TM T8111 TM T81II TM T82 TM T82 TM T82II TM T82Il TM T9OII TM T90II Chapter 4 API Reference e lang Specifies the language specifications for the printer TM printer separate setting e Set value Printer model A p gt Builder MODEL_ANK ANK vivivivi viviviviviv v Builder MODEL_JAPANESE OPOnese vivwvv wW w 1 v Builder N MODEL_CHINESE Simplified Chinese W VW WV w vw vWw W W a Traditional Chin viviviv v vv 2 MODEL_TAIWAN galeng ese PN Korean Y viv Vv MODEL_KOREAN Builder MODEL_THAI Thai PAA Fecal E key ee Pea A tel E E Builder MODEL_SOUTHASIA South Asian vi vvv w w v Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_UNSUPPORTED An unsupported model name or unsupported language specifications were specified ERR_FAILURE An unspecified error occurred Example If you are initializing the command buffer for the TM T88V ANK model try Builder builder new Builder TM T88V Builder MODEL_ANK Process catch EposException e int errStatus e getErrorStatus
63. TCP set the permissions for the application to access the network ipAdaress Specifies the IPv4 IP address for TCP communication If either of the following values is specified for enabled null can be specified for this Q parameter Log LOG_DISABLE Log LOG_STORAGE e port Specifies the port number for TCP communication Specifies an integer from O to 65535 Even if either of the following values is specified for enabled specify an integer within the Q range Log LOG_DISABLE Log LOG_STORAGE e logsize Specifies the maximum size of log data that is saved on the device s storage Specifies an integer from 1 to 50 Unit MB Even if either of the following values is specified for enabled specify an integer within the range Log LOG_DISABLE Log LOG_TCP e logLevel Specifies the level of log data to be output LOG_LOW Low level Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_FAILURE An unspecified error occurred 155 Example To output log data to port 8080 IP address 192 168 192 168 over TCP try Log setLogSettings getApplicationContext Log LOG_ PERMANENT Log LOG_TCP 192 168 192 168 8080 10 Log LOG_LOW catch EposException e int errStatus e getErrorStatus status 0 e getPrinterStatus To out
64. TM U330 TM 182 TM T82ll Image compression is Builder COMPRESS_DEFLATE A carried out Image compression is Builder COMPRESS_NONE not carried out Specify the half tone treatment method Builder PARAM_DEFAULT a ViVi Vi ViVi vi viv vv v viv Image compression is not carried out 2 For TCP or USB communication specify Builder PARAM_DEFAULT Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_ MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Example try Bitmap imageData null Builder builder new Builder TM T88V Builder MODEL_ANK Process builder addImage imageData 0 0 256 256 Builder PARAM DEFAULT Builder MODE MONO Builder HALFTONE DITHER 1 0 Builder PARAM DEFAULT Process catch EposException e int errStatus e getErrorStatus 75 76 addimage Previous format Adds raster image printing to the command buffer When the Bluetooth interface is used white streaks may appear because printing by image data compression is not possible Prints the graphic in the android graphics Bitmap class Out of the android graphics Bitmap class graphics the specified scope is converted to raster image data according to this API setting 1 pixel of the i
65. VTYPE_TCP 192 168 192 168 Print TRUE Print PARAM DEFAULT Process catch EposException e int errStatus e getErrorStatus Chapter 4 API Reference setBatteryStatusChangeEventCallback This registers the notification destination of battery status When this API is executed on multiple occasions the notification destination that is specified This API can be executed following execution of openPrinter p 114 Q afterwards is overwritten Syntax public void setBatteryStatusChangeEventCallback BatteryStatusChangeEventListener target Parameter e target This specifies the object listener interface that has the notification destination method listener registration method If null is specified for either the method or target the noti fication destination registration is nullified Listener Interface public interface BatteryStatusChangeEventListener extends EventListener Listener Registration Method void onBatteryStatusChangeEvent String deviceName int battery Parameter 4 e deviceName The identifier IPv4 type IP address BD address Device node Printer host name of the device thot is notified of battery status is set e battery Battery status is set Example public class SampleActivity extends Activity implements OnClickListener BatteryStatusChangeEventListener Process private void onBatteryStatusChangeEvent String dev
66. World n String for which the addTextFont setting is disabled builder addTextFont Builder FONT_B String for which the addTextFont setting is enabled FONT_B builder addText Hello World n printer sendData builder 10000 status Chapter 3 Programming Guide Printing After Checking the Printer Status To ensure successful print operation print after checking the printer status Send the empty print data and if the printer is online print it Use the programming example below for your reference lt Send data for confirmation gt Print printer new Print int status new int 1 status 0 0 Builder builder null try Create a print document Builder builder new Builder TM T88V Builder MODEL_ANK 1 builder addText Hello World n builder addCut Builder CUT_FEED nitialize a Builder class instance for confirmation 2 Builder confirmBuilder new Builder TM T88V Builder MODEL_ANK lt Start communication with the printer gt printer openPrinter Print DEVTYPE_TCP 192 168 192 168 lt Send data for confirmation gt printer sendData confirmBuilder 10000 status 3 if status 0 amp Print ST_OFF_LINE Print ST_OFF_LINE lt Send print data gt 4 printer sendData builder 10000 status else if status 0 amp Print ST_OFF_L
67. a 420 dots x 1662 dots W x H 576 dots x 1662 dots W x H Barcode UPC A UPC E EAN13 JAN13 EAN8 JAN8 CODE39 ITF CODABAR CODE93 CODE128 GS1 128 GS1 DataBar Omnidirectional GS1 DataBar Truncated GS1 DataBar Limited GS1 DataBar Expanded Two Dimensional Code PDF417 QR Code MaxiCode 6S1 DataBar Stacked GS1 DataBar Stacked Omnidirectional GS1 DataBar Expanded Stacked Composite Symbology Paper Cut Cut Feed cut Drawer Kick Out Supported Buzzer Not supported Battery Not supported 184 Appendix TM T20ll 58 mm 80 mm Interface Ethernet Bluetooth USB Resolution 203 dpi x 203 dpi W x H Language ANK model Print Width 420 dots 576 dots Characters in a Line Font A ANK 35 characters ANK 48 characters Font B ANK 46 characters ANK 64 characters Character Size Font A ANK 12 dots x 24 dots W x H Font B ANK 9 dots x 17 dots W x H Character Baseline Font A At the 21st dot from the top of the character Font B At the 16th dot from the top of the character Default Line Feed Space 30 dots Color Specification First color Page Mode Default Area 420 dots x 831 dots W x H 576 dots x 831 dots W x H Page Mode Maximum Area 420 dots x 1662 dots W x H 576 dots x 1662 dots W x H Barcode UPC A UPC E EAN13 JAN13 EAN8 JAN8 CODE39 ITF CODABAR CODE93 CODE128 GS1 128 GS1 DataBar Omnidirectional 6S1 DataBar Truncated GS1 DataBar Limited
68. a none a aa a rr rr rra rr rr rr rana rr rr E 37 Printing After Checking the Printer StOtUS oo nono ro ron rro rr rra rr rre 39 E Automatic Acquisition of Printer StatUS oocooonicccccnnonononcncccnnonnnnnccnnnnnnnnnnnnnnnnnnannnnnnns 41 Listener Interface LISTS air ad ida 42 E Exception handling iaa di 44 Steps for Handle 45 Error Statuses and Actions To TOK Varia A a atid E dees 47 Printer Statuses and ACTIONS TO Takasen nigan aa a E a 49 BOTTORY STATUS uds 50 API Reference A 51 Eer aia a ad EEE AET A T 51 Bullder class Construc mii a e a a A aaa TE EEE a T a 54 Builder class Constructor Previous TOMO cococccccononcnccnoonnnnncnnonnnonnncnnn nr nnononn nr rn nono nn rrrrnron rr rr raninnnos 56 elsarcomma dr acia Saia e tt coda lada Dl diosa 58 addle TAO ica a dd ile cn dc A aa di ron antsy 59 dde SPUCS Aid da a ca 60 Ada TsxTROTOTS A A a a Ne BIR ee da 61 A E ENCON 62 GAGTEXTILONG A We gan AE alert tatiana ivi nies 63 IGS XT FOR ies te tethe tetas tite teats nil neta Dte oe tet te al cated Mnetaitiuee teas ANE 64 COGTEXTSMOOIM sex ceed aia a A A ee AG a A A ae Bees 65 AS A AA 66 GOGISXISIZS caridad a a a de A 67 IGT XT STV O E ieattursanentseasteataunes 68 addlext Postio Nse A A A PA I IU a el ee eds 70 GIGI RSS ites ian oiea aana OREA aa T Eaa Upa NT venus SAO RACE O 71 adadFSS LIN ANA AA AA O CR AA DA E AS 72 addlMage ida aran cian at 73 addalmage Previous TO MOD vicios EUR dd sabes saved dd da E 76 GAAIMAGS Prev
69. aBar Stacked Omnidirectional GS1 DataBar Expanded Stacked Paper Cut Cut Feed cut Drawer Kick Out Supported Buzzer Supported Battery Not supported 172 Appendix TM T9OII 58 mm 80 mm Interface Ethernet Wi Fi USB Resolution 203 dpi x 203 dpi W x H Language Japanese model Print Width 416 dots 576 dots Characters in a Line Font A 35 characters 48 characters Font B 42 characters 57 characters Font C 52 characters 72 characters Character Size Font A 12 dots x 24 dots W x H Font B 9 dots x 17 dots W x H Font C 8 dots x 16 dots W x H Character Baseline Font A At the 21st dot from the top of the character Font B At the 15th dot from the top of the character Font C At the 15th dot from the top of the character Default Line Feed Space 30 dots Color Specification First color Page Mode Default Area 416 dots x 1662 dots WxH 576 dots x 1662 dots WxH Page Mode Maximum Area 416 dots x 1662 dots WxH 576 dots x 1662 dots WxH Barcode Codabar Code339 ITF JAN13 EAN JAN8 EAN UPC A UPC E Code93 Code128 GS1 128 GS1 DataBar Omni directional GS1 DataBar Truncated GS1 DataBar Expanded 6S1 DataBar Limited Two Dimensional Code PDF417 QRCode MaxiCode 6S1 DataBar Stacked GS1 DataBar Stacked Omni directional GS1 DataBar Expanded Stacked Paper Cut Cut Feed cut Drawer Kick Out Supported Buzzer Supported Battery N
70. ame in the analysis result Format String printerName Stores the BD address in the analysis result Format String macAddress 153 Log Setting API Sets the log output The following class is available m Log class p 154 Log class Sets the log output function setLogSettings Sets the log output function 154 setLogSettings Sets the log output function Syntax public static void setLogSettings Context context int period int enabled String ipAddress int port int logSize int loglLevel throws EposException Parameter e context Specifies the context of the application e period Specifies the method of setting the log output function Log LOG_TEMPORARY The settings of this API are disabled when the application is ended Log LOG_PERMANENT The nes ci INE API are enabled even after the application is ended To specify period for the Log LOG_PERMANENT set the permissions for the application Q to access the storage 154 Chapter 4 API Reference e enabled Specifies whether to enable the log output function and the log output destination Set value Description Log LOG_DISABLE Disables the log output function Log LOG_STORAGE Outputs log data to the device s storage Log LOG_TCP Outputs log data over TCP e To specify enabled for the Log LOG_STORAGE set the permissions for the application 3 to access the storage To specify enabled for the Log LOG_
71. annot be acquired 181 TM U220 76 mm 69 5 mm 57 5 mm Interface Ethernet Wi Fi USB Resolution Single l 72 WxH density 80 dpi x 72 dpi W x H Double ix 72 dpi WxH density 60 dpi x 72 dpi W x H Language e ANK model e Japanese model e Simplified Chinese model e Traditional Chinese model e Korean model e Thai model e South Asian model O Angle 200 dots 180 dots 150 dots density Double 400 or 385 half dots 360 half dots 300 or 297 half dots density Characters in a Line Font A ANK 33 characters ANK 30 characters ANK 25 characters Font B ANK 40 characters ANK 36 characters ANK 30 characters Character Size Font A ANK 9 dots x 9 dots W x H Font B ANK 7 dots x 9 dots W x H Character Baseline Font A Font B Default Line Feed Space 12 dots Color Specification First color Page Mode Default Area Page Mode Maximum Area Barcode Not supported Two Dimensional Code Not supported Paper Cut Cut No cut Drawer Kick Out Supported Buzzer Not supported Battery Not supported 182 DipSW2 1 ON Appendix TM U330 76 mm 69 5 mm 57 5 mm Interface Ethernet Wi Fi USB ne yes 80 dpi x 72 dpi W x H ars 160 dpi x 72 dpi W x H Language e Simplified Chinese model Print Width 120 dpi base 300 dots 270 dots 225 dots 240 dpi base 600 dots 540
72. aseline Font A At the 21st dot from the top of the character Font B At the 16th dot from the top of the character Default Line Feed Space 30 dots Color Specification First color Page Mode Default Area 420 dots x 831 dots W x H 576 dots x 831 dots W x H Page Mode Maximum Area 420 dots x 1662 dots W x H 576 dots x 1662 dots W x H Barcode UPC A UPC E EAN13 JAN13 EAN8 JAN8 CODE39 ITF CODABAR CODE93 CODE128 GS1 128 GS1 DataBar Omnidirectional 6S1 DataBar Truncated GS1 DataBar Limited GS1 DataBar Expanded Two Dimensional Code PDF417 QR Code MaxiCode 6S1 DataBar Stacked GS1 DataBar Stacked Omnidirectional GS1 DataBar Expanded Stacked Composite Symbology Paper Cut Cut Feed cut Drawer Kick Out Supported Buzzer Optional Battery Not supported 188 Appendix TM T83ll 58 mm 80 mm Interface Ethernet USB Resolution 180 dpi x 180 dpi W x H Language e Korean model Print Width 360 dots 512 dots Characters in a Line Font A ANK 30 characters ANK 42 characters Font B ANK 40 characters ANK 56 characters Character Size Font A ANK 12 dots x 24 dots W x H Font B ANK 9 dots x 17 dots W x H Character Baseline Font A At the 21st dot from the top of the character Font B At the 16th dot from the top of the character Default Line Feed Space 30 dots Color Specification First color Page Mode Default Area 360 dots x 831 dots W x H 512 dots x 83
73. ate memory ERR_FAILURE An unspecified error occurred Example To repeat the sound pattern A three times try Builder builder new Builder TM T88V Builder MODEL_ANK builder addSound Builder PATTERN_A 3 Process catch EposException e int errStatus e getErrorStatus 107 108 addFeedPosition Adds label black mark paper feeding to the command buffer Syntax public void addFeedPosition int position throws EposException Parameter e position Specifies the feed position Set value Description Builder FEED_PEELING Feeds to the peeling position Builder FEED_CUTTING Feeds to the cutting position Builder FEED_CURRENT_TOF Feeds to the top of the current label Builder FEED_NEXT_TOF Feeds to the top of the next label Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Example To feed a label paper to the peeling position try Builder builder new Builder TM P60II Builder MODEL_ANK builder addFeedPosition Builder FEED_PEELING Process catch EposException e int errStatus e getErrorStatus Chapter 4 API Reference addLayout Adds label black mark paper layout information to the command buffer Syntax public
74. ation registration API public interface BatteryOkEventListener extends EventListener Battery OK notification void onBatteryOkEvent String deviceName setBatteryOkEventCallback p 138 public interface BatteryStatusChangeEventListener extends EventListener Battery status notification void onBatteryStatusChangeEvent String deviceName int battery setBatteryStatusChangeEventCallback p 139 43 Exception handling In ePOS Print SDK for Android it is designed that when an error occurs a propriety exception with an integer int type parameter is generated to notify the calling side of such an error The ePOS Print API acquires information using the EposException class p 53 and the search API acquires information using the EposException class p 53 The following errors are sent Cause of error when each class s API was executed E tat dio For details refer to Error Statuses and Actions to Take p 47 Status of the printer when print data was sent The printer status can be acquired only when sendData Previous format p 124 is executed For details refer to Printer Statuses and Actions to Take p 49 Status of the printer s battery For details refer to Battery Status 0 50 Printer status Battery status 44 Chapter 3 Programming Guide Steps for Handling ePOS Print API Acquire the error status using the EposException class getErrorStatus p 140 the printer
75. atus battery status Compatible with Asian languages simplified Chinese traditional Chinese Korean Thai Vietnamese Printer Search API a Search for printers Printer Easy Select API 1 Select a printer easily You can select a printer easily by using NFC or AR code Log Setting API a Log output setting This API allows to output log data to an Android device s storage and a server that can establish TCP connection Log data output to an Android device can be saved on other computers using a USB Q connection Operating Environment Android Version Chapter 1 Overview g Android Version 2 3 3 to 2 3 7 1 Android Version 3 1 to 3 2 2 1 Android Version 4 0 to 4 4 e USB is supported for Android Version 3 1 and over Q e For the latest version refer to the README file Android Device Device that supports ARMv5TE f Interface TM Printer l TM T88V Vv Vv Vv Vv TM T20 Vv Vv TM T20I Vv Vv Vv TM T70 Vv Vv Vv TM T7Ol Vv Vv Vv Vv TM T82 Vv Vv TM T82Il Vv Vv TM T8111 Vv Vv TM T83ll Vv Vv TM T9OII Vv Vv Vv TM P20 Vv Vv Vv TM P60 Receipt Wi Fi Vv TM P60 Receipt Bluetooth Vv 3 TM P60 Peeler Wi Fi Y TM P60 Peeler Bluetooth Vv TM P60II Receipt Wi Fi Vv Vv TM P6OII Receipt Bluetooth Y Y TM P60ll Peeler Wi Fi Y Vv TM P 60Il Peeler Bluetooth
76. aws a line in page mode Diagonal lines cannot be drawn Q e Use this API function by inserting it between addPageBegin p 92 and addPageEnd p 93 Syntax public void addPageLine int x1 int yl int x2 int y2 int style throws EposException Parameter e xl Specifies the horizontal start position of the line in dots Specifies an integer from O to 65535 e yl Specifies the vertical start position of the line in dots Specifies an integer from O to 65535 e x2 Specifies the horizontal end position of the line in dots Specifies an integer from O to 65535 e y2 Specifies the vertical end position of the line in dots Specifies an integer from O to 65535 e style Specifies the line type Builder LINE_THIN Solid line Thin Builder LINE_MEDIUM Solid line Medium Builder LINE_THICK Solid line Thick Builder LINE_THIN_DOUBLE Double line Thin Builder LINE_MEDIUM_DOUBLE Double line Medium Builder LINE_THICK_DOUBLE Double line Thick Builder PARAM_DEFAULT Solid line Thin Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Chapter 4 API Reference Example To draw a thin solid line between the start position 100 0 and the end position 500 0 try Builder builder new B
77. be specified e Pv4 IP address Example 192 168 192 168 e MAC address Example 01 23 45 67 89 AB e Printer host name Arbitrary string Print DEVTYPE_BLUETOOTH BD address Example 01 23 45 67 89 AB Print DEVTYPE_USB Device node Q When a printer s IP address is set as DHCP specify a MAC address or printer host name for deviceName When Print DEVTYPE_TCP is selected for deviceType and a printer host name is specified for deviceName use in an environment in which it is possible to search for a printer host name from the DNS server 114 Chapter 4 API Reference e enabled This specifies whether printer status monitoring is enabled or disabled Specified Value Print TRUE Enabled Print FALSE Disabled Print PARAM_DEFAULT Select default value disabled e interval This specifies the interval in units of milliseconds for updating printer status Specified Value 1000 to 60000 integer Interval for updating printer status in units of millisec onds Print PARAM_DEFAULT Specify the default value 1000 e timeout This specifies the maximum waiting time in milliseconds for establishing communica tion with the printer Specified Value 1000 to 300000 integer Maximum waiting time until an error is returned Print PARAM_DEFAULT Specify the default value 15000 Ifthe specified device does not exist an error is returned immediat
78. cally notify printer status to the application Refer to the following Registration of StatusChangeEventListener for giving notification of printer status 1 public class SampleActivity extends Activity implements OnClickListener StatusChangeEventListener Process Implement the StatusChangeEventListener method private void onStatusChangeEvent String deviceName int status 2 5 Process private void openPrinter Initialize the print class instance Print printer new Print Register the notification destination of printer status changes 3 printer setStatusChangeEventCallback this try Start communications with the printer and monitoring of the printer status printer openPrinter Print DEVTYPE TCP 192 168 192 168 Print TRUE 4 Print PARAM DEFAULT Process catch EposException e int errStatus e getErrorStatus printer closePrinter A Define the listener interface for acquiring the printer status Above StatusChangeEventListener which notifies printer status at the intervals Q specified in openPrinter p 114 is defined ePOS Print has listener interfaces according to each printer status for example events such as cover open and drawer open Use these according to the desired purpose of use See the Listener Interface List p 42 for the listener interface that can be used with ePOS Print Imp
79. cels rotated printing of text Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Example To set text rotation try Builder builder new Builder TM T88V Builder MODEL_ANK builder addTextRotate Builder TRUE Process catch EposException e int errStatus e getErrorStatus 61 62 addText Adds the printing of text to the com mand buffer printed After printing text to print content other than text execute line feed or paper feed Q Example After printing text an attempt was made to perform graphic printing but nothing was Syntax public void addText String data throws EposException Parameter e data Specify a character string to be printed For the horizontal tab line feed use the following escape sequences SS AS AA ed t Horizontal tab HT n Line feed LF Carriage return Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Example To add character strings try Builder builder Process int errStatus e builder addText Hello
80. class p 51 Create a Builder class using the constructor for it and create a print document using APIs of the Builder class Use the programming example below for your reference try Initialize a Builder class instance Builder builder new Builder TM T88V Builder MODEL ANK Create a print document builder addTextLang Builder LANG EN builder addText Smooth Builder TRUE builder addTextFont Builder FONT_A builder addTextSize 3 3 builder addText Hello t builder addText World n builder addCut Builder CUT_FEED catch EposException e int errStatus e getErrorStatus To create a text print document To create a text print document using APIs for text store the font settings in command buffers to create a print document Use the programming example below for your reference For the string Hello World to create a print document based on the following settings e Font FontA e Scale x 4 horizontal and x 4 vertical e Style Bold try nitialize a Builder class instance Builder builder new Builder TM T88V Builder MODEL_ANK Create a print document lt Configure the print character settings gt builder addTextLang Builder LANG_EN builder addTextSmooth Builder TRUE builder addTextFont Builder FONT_A builder addTextSize 4 4 builder addTextStyle Builder FALSE Builder FALSE Builder TRUE Builder PARAM UNSPECIFIED
81. d onCoverOkEvent String deviceName setCoverOkEventCallback p 130 Cover open notification public interface CoverOpenEventListener extends EventListener void onCoverOpenEvent String deviceName setCoverOpenEventCallback p 131 Paper OK notification public interface PaperOkEventListener extends EventListener void onPaperOkEvent String deviceName setPaperOkEventCallback p 132 Paper near end notification public interface PaperNearEndEventListener extends EventListener void onPaperNearEndEvent String deviceName setPaperNearEndEventCallback p 133 Paper end notification public interface PaperEndEventListener extends EventListener void onPaperEndEvent String deviceName setPaperEndEventCallback p 134 Drawer close notification public interface DrawerClosedEventListener extends EventListener void onDrawerClosedEvent String deviceName setDrawerClosedEventCallback p 135 Drawer open notification public interface DrawerOpenEventListener extends EventListener void onDrawerOpenEvent String deviceName setDrawerOpenEventCallback p 136 Battery low notification public interface BatteryLowEveniListener extends EventListener void onBatteryLowEvent String deviceName setBatteryLowEventCallback p 137 Chapter 3 Programming Guide Event listener Function Notification destination method Notification destin
82. data size Specifies an integer in the range 0 600000 in milliseconds e status The printer status when command transmission ended is set A combination of printer status settings is set For details refer to Printer Statuses and Actions to Take p 49 In an exception occurs use the getPrinterStatus p 141 with exception processing to get the Q printer status Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_ILLEGAL This API was called when communication had not started yet ERR_PROCESSING Could not execute process ERR_TIMEOUT Could not send all the data within the specified time ERR CONNECT Connection error occurred ERR_MEMORY Could not allocate memory ERR_OFF_LINE The printer was offline ERR_FAILURE An unspecified error occurred 124 Chapter 4 API Reference Example To send a command to the printer by specifying 10 seconas for its timeout parameter Print printer new Print int status new int 1 status 0 0 try 1 Builder builder new Builder TM T88V Builder MODEL_ANK builder addText ABCDE printer openPrinter Print DEVTYPE_TCP 192 168 192 168 printer sendData builder 10000 status printer closePrinter catch EposException e int errStatus e getErrorStatus status 0 e getPrinterStatus
83. data to be output Set the method of saving the settings in Save Settings Permanently Ge Tap Setting to enable the log output settings A After printing check the log file For details refer to setLogSettings p 154 al Chapter 2 Sample Program Execution result Process execution result Any of the following will be displayed e Result Any of the following statuses will be displayed SUCCESS Succeeded ERR_PARAM An invalid parameter was passed ERR_ILLEGAL Used in an illegal manner ERR_PROCESSING Failed to execute the process ERR_TIMEOUT The process was timed out ERR_CONNECT Failed to connect to the device ERR_MEMORY Could not secure the memory required for the process ERR_OFF_LINE Offline ERR_FAILURE Another error occurred e Status Any of the following printer statuses will be displayed NO_RESPONSE No response from the printer PRINT_SUCCESS Printing is successfully completed DRAWER_KICK Status of the 3rd pin of the drawer kick out connector H Other than TM P60 TM P60ll TM P80 BATTERY_OFFLINE Battery offline TM P60 TM P 0Il TM P80 OFF_LINE Offline COVER_OPEN The cover is open PAPER_FEED Paper is being fed by a paper feed switch operation WAIT_ON_LINE Waiting to be brought back online PANEL_SWITCH The paper feed switch is being pressed ON MECHANICAL_ERR A mechanical error occurred AUTOCUTTER_ERR An autocutter error occurred U
84. der new Builder TM T88V Builder MODEL_ANK builder addFeedUnit 30 Process catch EposException e int errStatus e getErrorStatus 71 72 addFeedLine Adds paper feeding in lines to the command buffer Syntax public void addFeedLine int line throws EposException Parameter e unit Specifies the paper feed space in lines Specifies an integer from O to 255 Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Example To feed paper by 3 lines try Builder builder new Builder TM T88V Builder MODEL_ANK builder addFeedLine 3 Process catch EposException e int errStatus e getErrorStatus Chapter 4 API Reference addlmage Adds raster image printing to the command buffer Prints the graphic in the android graphics Bitmap class Out of the android graphics Bitmap class graphics the specified scope is converted to raster image data according to this API setting 1 pixel of the image corresponds to 1 dot of the printer If transparent shading is included it is regarded as white Set image compression only for a Bluetooth interface 3 To print a raster image at high speed specify Builder ALIGN_LEFT for the addTextAlign p 59 and spec
85. developing Android applications for printing on an EPSON TM printer Applications are developed using the APIs provided by ePOS Print SDK The ePOS Print SDK also has the ePOS Print SDK for iOS for OS applications A command transmission reception API cannot be used with the ePOS Print API Print class For details on the command transmission reception APls refer to Command Transmission Reception p 159 2 APIs for transmitting receiving commands to from TM printers are also provided 4 Allows printing to TM printers from Android applications 1 Allows acquisition of TM printer status from Android applications 10 ePOS Print API LE COC wo L E O O oo O Print setting alignment line feed space text rotation page mode Character data setting language font device font double sizing scale smoothing print position Character style setting inversion of black and white underline bold Paper feed setting in dots in lines Image printing raster image NV graphics Barcode printing For barcodes that can be printed by each model refer to Support Information by Printer p 170 2D Code printing For 2D Code that can be printed by each model refer to Support Information by Printer p 170 Drawer kick function Buzzer function Paper layout setting Label black mark paper feed setting ESC POS command transmission Acquisition of response from printer printing result printer st
86. ditional Chin Aa lle v MODEL_TAIWAN Sa Seas Puldor Korean Y viv Vv MODEL_KOREAN Builder E MODEL THAI Thai VIwWIvvI l 1 v v Builder f MODEL SOUTHASIA South Asian ViVviviVvi wH4 4 4 4 e context Specifies the context of the application Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_UNSUPPORTED An unsupported model name or unsupported language specifications were specified ERR_FAILURE An unspecified error occurred Example If you are initializing the command buffer for the TM T88V ANK model import android content Context try Builder builder new Builder TM T88V Builder MODEL ANK getApplicationContext Process catch EposException e int errStatus e getErrorStatus 55 56 Builder class Constructor Previous format Constructor for the Builder class Initializes a Builder class instance The log output function cannot be used 3 To use the log output function use the Builder class Constructor p 54 Syntax public Builder String printerModel int lang throws EposException Parameter e printerModel Specifies the model name for the target printer TM T88V TM T88V TM T70 TM T70 TM T7Oll TM T7Oll TM U220 TM U220 TM
87. dots 450 dots 180 dpi base 450 dots 405 dots 337 dots Characters in a Line Font A ANK 42 characters ANK 38 characters ANK 32 characters Font B ANK 33 characters ANK 30 characters ANK 25 characters o dpi 16 characters 15 characters 12 characters aa 22 characters 20 characters 16 characters Character Size Font A ANK 9 dots x 24 dots W x H Font B ANK 7 dots x 24 dots W x H Chinese Kanji 24 dots x 24 dots W x H Character Baseline Font A Font B Chinese Default Line Feed Space 12 dots Color Specification First color Page Mode Default Area Page Mode Maximum Area Barcode Not supported Two Dimensional Code Not supported Paper Cut Cut No cut Drawer Kick Out Supported Buzzer Not supported Battery Not supported 183 TM T20 58 mm 80 mm Interface Ethernet USB Resolution 203 dpi x 203 dpi W x H Language e ANK model e Japanese model Print Width 420 dots 576 dots Characters in a Line Font A ANK 35 characters ANK 48 characters Font B ANK 46 characters ANK 64 characters Character Size Font A ANK 12 dots x 24 dots W x H Font B ANK 9 dots x 17 dots W x H Character Baseline Font A At the 21st dot from the top of the character Font B At the 16th dot from the top of the character Default Line Feed Space 30 dots Color Specification First color Page Mode Default Area 420 dots x 831 dots W x H 576 dots x 831 dots W x H Page Mode Maximum Are
88. dots x 1200 dots W x H 432 dots x 1200 dots W x H Barcode UPC A UPC E EAN13 JAN13 EAN8 JAN8 CODE339 ITF CODABAR CODE93 CODE128 Two Dimensional Code Not supported Paper Cut Cut No cut Drawer Kick Out Not supported Buzzer Supported Battery Supported 176 Appendix Battery Status Upper 8 bits 0x30 The AC adapter is connected 0x31 The AC adapter is not connected Lower 8 bits Battery Status 0x30 H level 0x31 M level 0x32 L level 0x33 S level 0x34 Battery not installed If Ox0000 is returned the battery status cannot be acquired N 177 TM P60Il 58 mm 60 mm Interface Wi Fi Bluetooth USB Resolution 203 dpi x 203 dpi W x H Language e ANK model e Traditional Chinese model Print Width 420 dots 432 dots Characters in a Line Font A ANK 35 characters ANK 36 characters Font B ANK 42 characters ANK 43 characters Font C ANK 52 characters ANK 54 characters Kanji font 17 characters 18 characters Character Size Font A ANK 12 dots x 24 dots W x H Font B ANK 10 dots x 24 dots W x H Font C ANK 8 dots x 16 dots W x H Kanji font ANK 24 dots x 24 dots W x H Character Baseline Font A At the 21st dot from the top of the character Font B At the 16th dot from the top of the character Font C At the 15th dot from the top of the character Kanji font At the 21st dot from the top of the character
89. e of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Chapter 4 API Reference Example To draw a rectangle with a thin solid line with the start position 100 0 and the end position 500 200 as its vertexes try Builder builder new Builder TM P60 builder addPageBegin builder addPageRectangle 100 0 500 200 builder addPageEnd Process catch EposException e int errStatus e getErrorStatus Builder MODEL_ANK Builder LINE_THIN 101 addCut Adds paper cut to the command buffer Sets paper cut 2 Not available in page mode Syntax public void addCut int type throws EposException Parameter e type Specifies the paper cut type Cut without feeding Builder CUT_NO_FEED i i The paper is cut without being fed Feed cut Builder CUT_FEED ie The paper is fed to the cut position and then is cut Cut reservation Builder CUT_RESERVE Printing continues until the cut position is reached at which the paper is cut Feed cut Builder PARAM_DEFAULT l P The paper is fed to the cut position and then is cut Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory
90. e printer by specifying 10 seconds for its timeout parameter Print printer new Print int status new int 1 int battery new int 1 status 0 0 battery 0 0 try 1 Builder builder new Builder TM P6011 Builder MODEL_ANK builder addText ABCDE printer openPrinter Print DEVTYPE_TCP 192 168 192 168 printer sendData builder 10000 status battery printer closePrinter catch EposException e int errStatus e getErrorStatus status 0 e getPrinterStatus battery 0 e getBatteryStatus 123 sendData Previous format Sends a print document created using the Builder class The battery status cannot be acquired If you want to acquire the battery status when sending a print document use sendData p 122 Q The battery status cannot be acquired If you are using a Bluetooth connection it may not be able to detect the offline status and timeout errors may occur If you use the printer from multiple mobile terminals see the Cautions p 190 Syntax public void sendData Builder builder int timeout int status throws EposException Parameter e builder Specifies a Builder class instance For details on the Builder class refer to Builder class p 51 e timeout Specifies the transmission reception waiting timeout time Adjust the timeout time according to the specifications for the model communication interface and transmission
91. ea a ate ae 134 setDrawerClosedEventEallback s scicssctsvecsvetes cate seca rial dee eo ad 135 setDrawerOpenEventCallback ici AA EA E A 136 selBatteryLowEventCallbackiiiiiaita Aa 137 selBattervOKEventTCallback cita A iba 138 setBatteryStatusCNangeEVentCad lO Ck wo no ron o nono rr rro raro 139 GESTEM O U Sena aa E a Re 140 getRrintSrStatUS iia ataca as 141 g tBartSryStTaTUS as m a O A 142 Mi Printer Secrehy API EEA AT A E A 143 OS 144 STOD O NS 145 JODA CO aaah 146 GeTResult Previous format aienea ed AE E Ad Ec 148 CST LOTUS A A capes sunny andes latpaauestaneSeaunsannaseenageevaseradgntees 149 E Printer Easy Select APlicuicinnioiia aia ii 150 pParseNFEl nani A dd ad ates 151 DO O O R dol cascode lod leo e do cin atid 151 TOMAR AA A SI 152 device lype a A RAE APN EASAN Dios 153 PNTE MS cia e E TE E O TEE AA RTA ao A S 153 MOGCAGGI SSS ars a a E a Cai a N 153 BE LOG Senin AP E E E E T T 154 SOON it a a a A a O E a Aaa 154 Command Transmission ReceptioN oooccccccccccccconnccnnnncccnnnn 159 A 159 Programming FOW airasia a idea loa 159 Opening G DeVICE Posa ro ans oats 160 SENING DOO iia o hii ceria aie hatter lianas 160 Recemving Datat amene e e ee ina ep Aan TA 161 Closing the Device POM ica ion A nai E ros 161 Exception handlingen a a ranean O nin ae tan mens Hee Eas 162 O e ere cde AO 163 ODEN PreviGUs TOrMal it A E IG aa a aa 165 CIOS A A te 166 WIHTC dida il AS wel ali baste lal din dala dire aidan 167 Odd taaa
92. eight in dots Specifies an integer from 1 to 255 Set value Description Integer from 1 to 255 The barcode height Unit dot Builder PARAM_UNSPECIFIED Retains the current setting Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred 85 86 Example To print barcodes try Builder builder builder addBarcode 01234567890 Builder HRI_BELOW builder addBarcode 01234500005 Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED builder addBarcode 201234567890 Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED builder addBarcode 201234567890 Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED builder addBarcode 2012345 Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED builder addBarcode 2012345 Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED builder addBarcode ABCDE Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED builder addBarcode 012345 Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED builder addBarcode A012345A Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED builder addBarcode ABCDE Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED builder addBarcode Babcde Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder PARAM U
93. ely Q When Print DEVTYPE_TCP is specified for deviceType if the specified device is already used an attempt is made to execute this API until the timeout time For Bluetooth communication specify Print PARAM_DEFAULT Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_OPEN The port open process failed ERR_TIMEOUT The device specified was already being used and communication with the printer could not be established within the timeout time ERR_ILLEGAL An attempt was made to start communicating with the device with which communication had already started ERR_PROCESSING Could not execute process ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Example Case where printer status monitoring is enabled and communications are commenced using Wi Fi Ethernet and a printer with an IP address of 192 168 192 168 Print printer new Print try printer openPrinter Print DEVTYPE_TCP 192 168 192 168 Print TRUE Print PARAM DEFAULT Print PARAM DEFAULT Process catch EposException e int errStatus e getErrorStatus 115 116 openPrinter Previous format This starts communications with the printer and monitoring of printer status if communication with the printer is not required anymore be sure to call closePrinter
94. enPrinter i i Mobile terminal A Poa SUCCESS i able to print T 1 2 openPrinter a SUCCESS aape gt l 1 3 sendData 1 1 As nnn ed i 4 Dat Printing processing 5 El iq De li gt ees ee ee ee ee Waits for terminal A s i 5 closePrinter closePrinter lt S o G el i Mobile terminal B able to print i Printing processing SUCCESS il a gt i i 6 closePrinter a APRA 190 Appendix Version 1 6 0 and later With Version 1 6 0 and later mobile terminal B will wait for mobile terminal A s closePrinter processing to end before executing openPrinter processing Mobile terminal A ea Mobile terminal B 1 openPrinter i Mobile terminal A SUCCESS able to print a a Se ee T 2 openPrinter pol 3 sendData a q l f Printing processing Waits for terminal A s closePrinter SUCCESS Mobile terminal B eee ee eit ee gt able to print k 4 sendData h Printing processing SUCCESS v 191 Open Source Software License Agreement In addition to proprietary Epson software ePOS Print SDK for Android uses open source software For information about the open source software used by ePOS Print SDK for Android see the following URL ZXing https github com zxing zxing ZXing is licensed based on Apache 2 0 license http www apache org licenses LICENSE 2 0 htm 19
95. ener Listener Registration Method void onPaperOkEvent String deviceName Parameter e deviceName The identifier IPv4 type IP address BD address Device node Printer host name of the device that is notified of paper ok event is set Example public class SampleActivity extends Activity implements OnClickListener PaperOkEventListener Process private void onPaperOkEvent String deviceName Process private void openPrinter Print printer new Print printer setPaperOkEventCallback this try printer openPrinter Print DEVTYPE_TCP 192 168 192 168 Print TRUE Print PARAM DEFAULT Process catch EposException e int errStatus e getErrorStatus Chapter 4 API Reference setPaperNearEndEventCallback This registers the notification destination of paper near end events This refers to events that are notified when printer status indicates paper is near the end When this API is executed on multiple occasions the notification destination that is specified This API can be executed following execution of openPrinter p 114 D afterwards is overwritten Syntax public void setPaperNearEndEventCallback PaperNearEndEventListener target Parameter e target This specifies the object listener interface that has the notification destination method listener registration method If null is specified for either the method
96. ener PowerOffEventListener Process private void onPowerOffEvent String deviceName Process private void openPrinter Print printer new Print printer setPowerOffEventCallback this try printer openPrinter Print DEVTYPE_TCP 192 168 192 168 Print TRUE Print PARAM DEFAULT Process catch EposException e int errStatus e getErrorStatus 129 130 setCoverOkEventCallback This registers the notification destination of cover close events This refers to events that are notified when printer status indicates cover close When this API is executed on multiple occasions the notification destination that is specified e This API can be executed following execution of openPrinter p 114 Q afterwards is overwritten Syntax public void setCoverOkEventCallback CoverOkEventListener target Parameter e target This specifies the object listener interface that has the notification destination method listener registration method If null is specified for either the method or target the noti fication destination registration is nullified Listener Interface public interface CoverOkEventListener extends EventListener Listener Registration Method void onCoverOkEvent String deviceName Parameter e deviceName The identifier IPv4 type IP address BD address Device node Printer host name of the device that is notified of cover ok
97. er PARAM_DEFAULT First color Chapter 4 API Reference e mode Specify the color mode TM printer separate setting Q 5 E er gt en E Set value Description E z lt Re E kE 1 mn N o O N g N co e 2 s 5 2 _ M h Builder MODE_MONO os viv v vivivivivivvvlv 2 tone Builder MODE_GRav16 Multiple tone AAA AS Ez 16 tone Specify the half tone Builder PARAM_DEFAULT treatment method Vviviviviviv vivy vv viv Monochrome 2 tone e halftone Specify the half tone treatment method Builder HALFTONE_DITHER Dither This is suitable for graphic printing Builder HALFTONE_ERROR_DIFFUSION Error diffusion This is suitable for mixed printing or charac ters and graphics Builder HALFTONE_THRESHOLD Threshold value This is suitable for printing of characters Builder PARAM_DEFAULT Default value dither selection In the case of multiple tone 16 tone this is disregarded e brightness Specify the correction value for brightness Actual figure from 0 1 to 10 0 Brightness correction value gamma value Builder PARAM_DEFAULT Select the default value 1 0 If you specify a value other than 1 0 the printing speed will become slower Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter wa
98. ermission in Permissions For using the Bluetooth functionality and all functionalities you must repeat settings from procedures 13 to 15 A GSove AndroidManifest xml Chapter 3 Programming Guide ePOS Print SDK Print Mode There are two types of print modes standard and page modes Standard mode In standard mode characters are printed line by line The line feed space is adjusted based on the font size and the height of images barcodes etc This mode is suitable for the type of printing such as printing receipts that requires the paper length to change according to the print space Page mode In page mode you set a print area lay out data in it and print the data in a batch operation Characters images and barcodes are laid out in the print positions coordinates Programming Flow Perform programming following this flow 1 Advance Preparations USB Connection p 30 2 Printer Selection p 31 lt Select printer using search function gt e Selecting a printer using the search function p 31 e Selecting a printer using NFC p 32 l Getting the printer search result p 31 lt Select printer using AR code gt Stopping the printer search p 32 3 Print Document Creation p 34 1 To create a text print document p 34 1 To create a graphic print document p 35 A To create a page mode print document p 36 4 Transmission of Print Document p
99. event is set Example public class SampleActivity extends Activity implements OnClickListener CoverOkEventListener Process private void onCoverOkEvent String deviceName Process private void openPrinter Print printer new Print printer setCoverOkEventCallback this try printer openPrinter Print DEVTYPE_TCP 192 168 192 168 Print TRUE Print PARAM DEFAULT Process catch EposException e int errStatus e getErrorStatus Chapter 4 API Reference setCoverOpenEventCallback This registers the notification destination of cover open events This refers to events that are notified when the cover is open concerning printer status When this API is executed on multiple occasions the notification destination that is specified This API can be executed following execution of openPrinter p 114 D afterwards is overwritten Syntax public void setCoverOpenEventCallback CoverOpenEventListener target Parameter e target This specifies the object listener interface that has the notification destination method listener registration method If null is specified for either the method or target the noti fication destination registration is nullified Listener Interface public interface CoverOpenEventListener extends EventListener Listener Registration Method void onCoverOpenEvent String deviceName Parameter e dev
100. fers to events that are notified when printer status is battery offline When this API is executed on multiple occasions the notification destination that is specified This API can be executed following execution of openPrinter p 114 Q afterwards is overwritten Syntax public void setBatteryLowEventCallback BatteryLowEventListener target Parameter e target This specifies the object listener interface that has the notification destination method listener registration method If null is specified for either the method or target the noti fication destination registration is nullified Listener Interface public interface BatteryLowEventListener extends EventListener Listener Registration Method void onBatteryLowEvent String deviceName Parameter e deviceName The identifier IPv4 format IP address BD address Device node Printer host name of the device that performed battery low event notification is set Example public class SampleActivity extends Activity implements OnClickListener BatteryLowEventListener Process private void onBatteryLowEvent String deviceName Process private void openPrinter Print printer new Print printer setBatteryLowEventCallback this try printer openPrinter Print DEVTYPE_TCP 192 168 192 168 Print TRUE Print PARAM DEFAULT Process catch EposException e int errStatus e getErrorStatus
101. ge corresponds to 1 dot of the printer If transparent shading is includea it is regarded as white e When printing in multiple tone use addlmage p 73 Q To print a raster image at high speed specify Builder ALIGN_LEFT for the addTextAlign p 59 and specify a multiple of 8 not exceeding the printer s paper width for the width parameter of this API When printing transmission images the printing speed may become slower Syntax public void addImage Bitmap data int x int y int width int height int color throws EposException Parameter e data Specifies an instance of the android graphics Bitmap class e x Specifies the horizontal start position in the print area Specifies an integer from O to 65534 e y Specifies the vertical start position in the print area Specifies an integer from 0 to 65534 e width Specifies the width of the print area Specifies an integer from 1 to 65535 e height Specifies the height of the print area Specifies an integer from 1 to 65535 e color Specifies the color Builder COLOR_NONE Characters are not printed Builder COLOR_1 First color Builder PARAM_DEFAULT First color If the area specified by the x y parameters and the width height parameters extends beyond the Q image size specified by the data parameter an EposException with ERR_PARAM contained in its error status occurs Exceptions When processing fails EposException is thrown with
102. haracter FNC1 a check digit and a stop character are automatically added To automatically calculate and add a check digit for an application identifier Al and the subsequent data specify the character in the position of the check digit You can enclose an application identifier Al in parentheses The parentheses are used as HRI print characters and are not encoded as data You can insert spaces between an application identifier GS1 128 AD and data The spaces are used as ARI print characters and are not encoded as data To encode each of the following characters specify two characters starting with the character FNC1 0 FNC3 8 C 0 Eu GS1 DataBar Omnidi rectional GS1 DataBar Truncated GS1 DataBar Limited Specify a 13 digit global trade item number GTIN not including an application identifier Al or a check digit GS1 DataBar Expanded You can enclose an application identifier Al in parentheses The parentheses are used as HRI print characters and are not encoded as data To encode each of the following characters specify two characters starting with the character FNC1 a C 0 83 To specify binary data that cannot be represented by character strings use the following escape sequences PA PP er xnn Control
103. iceName The identifier IPv4 type IP address BD address Device node Printer host name of the device that is notified of cover open event is set Example public class SampleActivity extends Activity implements OnClickListener CoverOpenEventListener Process private void onCoverOpenEvent String deviceName Process private void openPrinter Print printer new Print printer setCoverOpenEventCallback this try printer openPrinter Print DEVTYPE_TCP 192 168 192 168 Print TRUE Print PARAM DEFAULT Process catch EposException e int errStatus e getErrorStatus 131 132 setPaperOkEventCallback This registers the notification destination of paper OK events This refers to events that are notified when printer status indicates paper OK When this API is executed on multiple occasions the notification destination that is specified e This API can be executed following execution of openPrinter p 114 Q afterwards is overwritten Syntax public void setPaperOkEventCallback PaperOkEventListener target Parameter e target This specifies the object listener interface that has the notification destination method listener registration method If null is specified for either the method or target the noti fication destination registration is nullified Listener Interface public interface PaperOkEventListener extends EventList
104. iceName int battery Process private void openPrinter Print printer new Print printer setBatteryStatusChangeEventCallback this try printer openPrinter Print DEVTYPE_TCP 192 168 192 168 Print TRUE Print PARAM DEFAULT Process catch EposException e int errStatus e getErrorStatus 139 getErrorStatus Acquire the error status from an exception Syntax public int getErrorStatus Return value Returns the error status set by the API in which an exception occurred Example To acquire the error status from EposException try 1 printer openPrinter Print DEVTYPE_TCP 192 168 192 168 catch EposException e int errStatus e getErrorStatus if errStatus EposException ERR_OPEN Process 140 Chapter 4 API Reference getPrinterStatus Acquires the printer status from an exception that occurred in sendData p 122 Syntax public int getPrinterStatus Return value Returns the printer status A combination of printer status settings is set For details refer to Printer Statuses and Actions to Take p 49 Example To acquire the printer status from EposException int printerStatus new int 1 printerStatus 0 0 int timeout 1000 try printer sendData builder timeout printerStatus catch EposException e int errSratus e getErrorStatus if errStatus EposExcep
105. ies 6 In the Package Explorer View right click the ePOSPrintSample project or the ePOSEasySelectSample project and then select Run As Android Application Y The sample program will be installed to the target Android device and then the program will start up 17 How to Use the Program Sample This section describes how to use the program sample for the following operations 1 ePOSPrintSample e Search for printers and printing p 18 e Acquisition of Printer Model Name p 25 1 ePOSEasySelectSample e Printer Selection Using NFC or AR Code p 26 e QR Code Printing p 26 Search for printers and printing Use the sample program as follows 1 2 A Q Start the sample program For details refer to Environmental Construction p 17 Search for printers Tap Printer Discovery on the main screen Select Device Type to display a list of IP addresses Mac addresses USB device nodes for the printers retrieved on the Printer List Tap the printer to use from Printer List disolayed Open the printer s port Tap Open on the main screen The Device Type and IP Address Mac Address Device Node of the printer selected in procedure 3 are displayed Select Printer Name and Language Set Status Monitor lem Description e ON The status monitor is enabled and the printer status is monitored Enabled O e OFF The status monitor is disabled al When Enabled is turned
106. ify a multiple of 8 not exceeding the printer s paper width for the width parameter of this API e When printing transmission images the printing speed may become slower Multiple tone printing is not supported in Page Mode Multiple tone graphic printing is supported in Standard Mode only Image compression is not supported in Page Mode Syntax public void addImage Bitmap data int x int y int width int height int color int mode int halftone double brightness int compress throws EposException Parameter e data Specifies an instance of the android graphics Bitmap class e x Specifies the horizontal start position in the print area Specifies an integer from O to 65534 e y Specifies the vertical start position in the print area Specifies an integer from O to 65534 e width Specifies the width of the print area Specifies an integer from 1 to 65535 e height Specifies the height of the print area Specifies an integer from 1 to 65535 If the area specified by the x y parameters and the width height parameters extends beyond the Q image size specified by the data parameter an EposException with ERR_PARAM contained in its error status occurs e color Specifies the color Builder COLOR_NONE Characters are not printed Builder COLOR_1 First color Builder PARAM_DEFAULT First color 73 74 e mode Specify the color mode TM printer separate setting 9 3 R _
107. in timeout the process ends Syntax public int read byte data int offset int size int timeout throws EpsonloException Parameter e data The receiving data buffer for storing received data e offset Specifies the point to start storing data in the receiving data buffer Please specify the offset value from the top of the receiving data buffer e size Specifies the number of bytes that can be received If 0 is specified for size no data will be received In such a case the return value will be Q or e timeout Specifies the time in milliseconds to receive data The maximum value that can be specified is 600000 which equates to 10 minutes Return value Returns the number of bytes that were received Exceptions When processing fails EpsonloException is thrown with one of the following error values loStatus ERR_ILLEGAL This API was called when no device port was open loStatus ERR_PROCESSING Could not execute process loStatus ERR_PARAM Invalid parameter was passed loStatus ERR_CONNECT Connection error occurred loStatus ERR_MEMORY Could not allocate memory loStatus ERR_FAILURE An unspecified error occurred 168 Appendix Appendix List of Supported APIs for Each Printer Model o o 9 z o lo Z 2 2 3 Z Z Z Z Z Z Z Z 3 Z Z 3 2 addTextAlign p 59
108. int Chapter 3 Programming Guide Programming Guide This chapter describes how to write programs in the application development using ePOS Print SDK For ways to construct a development environment for Android applications that use ePOS Print Q SDK for Android please refer to the ePOS Print SDK for Android Application Development Setup Guide How to Incorporate the ePOS Print SDK for Android This section explains how to incorporate the ePOS Print SDK for Android This explanation uses Eclipse If you are using another development environment please make Q the appropriate changes Incorporate the SDK using following procedures A Create a new project in Eclipse 2 Copy provided JAR file ePOS Print jar eROSEasySelect jar into following path Libs ePOS Print jar lePOSEasySelect jar z ePOSEasySelect jar is required only when Printer Easy Select is used 3 In Libraries tab of the target project s properties confirm that the JAR file you added ePOS Print jar is registered in Java Build Path If it has not been added add the JAR file into build path using Add Jars 4 Copy the library file libeposprint so into following path Libs Larmeabi Lilibeposprint so 5 Select the project in Eclipse s Package Explorer right click on it and press Refresh 27 28 Write the package import declaration in the java source file s of the applicati
109. inter openPrinter Print DEVTYPE_TCP 192 168 192 168 Print TRUE Print PARAM DEFAULT Process catch EposException e int errStatus e getErrorStatus 127 128 setOfflineEventCallback This registers the notification destination of offline events This is the notification method when printer is offline concerning printer status When this API is executed on multiple occasions the notification destination that is specified e This API can be executed following execution of openPrinter p 114 Q afterwards is overwritten Syntax public void setOfflineEventCallback OfflineEventListener target Parameter e target This specifies the object listener interface that has the notification destination method listener registration method If null is specified for either the method or target the noti fication destination registration is nullified Listener Interface public interface OfflineEventListener extends EventListener Listener Registration Method void onOfflineEvent String deviceName Parameter e deviceName The identifier IPv4 type IP address BD address Device node Printer host name of the device that is notified of offline event is set Example public class SampleActivity extends Activity implements OnClickListener OfflineEventListener Process private void onOfflineEvent String deviceName Process private void openP
110. inversion of black and white for text Set value Description Builder TRUE Specifies the inversion of black and white parts of characters Builder FALSE default Cancels the inversion of black and white parts of characters Builder PARAM_UNSPECIFIED Retains the current setting e ul Specifies the underline style Builder TRUE Specifies underlining Builder FALSE default Cancels underlining Builder PARAM_UNSPECIFIED Retains the current setting e em Specifies the bold style Set value Builder TRUE Specifies emphasized printing of characters Builder FALSE default Cancels emphasized printing of characters Builder PARAM_UNSPECIFIED Retains the current setting e color Specifies the color Set value Builder COLOR_NONE Characters are not printed Builder COLOR_1 default First color Builder PARAM_UNSPECIFIED Retains the current color setting Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred 68 Chapter 4 API Reference Example To set the underline style try Builder builder new Builder TM T88V Builder MODEL_ANK builder addTextStyle Builder PARAM UNSPECIFIED Builder TRUE Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Process catch EposException e int errStatus e getErrorStatus
111. ius FOMMAN mimica conca edo de dada 79 olele o1 ira tt bd E 81 dadabarco daa a eth ee ra ta nd is 82 ACASO iaa A A A a a E 87 olele HESE AR EEE E ATATA at oia Or oro acds 92 GOGPAGEEN A AN 93 o A RO 94 COCGPAGEDIFSCTION iii A A AA aA a 95 olele zele EKONO NAE ATOE coa rad ads 97 ddaPage liN S rior a A rei 98 addPagereSctanale im datada o aAa a A atlas dde 100 AAC A AA Re ee aa 102 A RO 103 o NO 104 addSound Previous TORMO c occcccccoconccononononcnnonnnonnnonono nono ronon o rn nr ono nr rr rro ron enn r rr nron nn rnrrnnnn nn rra rana rr GEESE 106 GCOUGESCOPOSINON tien cas dan id A A A i a de 108 NA A E T A AA NT 109 AdACAMAMAA Li e 111 Print Class CONSTUCTON cua rs A AA A EA la 112 Print class Constructon Previ0US TOMO ne ennea e a iE non n rr nr rro nr rr nr EE nacos 113 OPSNPINTE as opan a N E A A wa iain 114 openPrinter PrevioUs Torna zent keen A ad 116 penPrinter Previo s TOMA isna kena a A A aa er biel Ages Ov iaae 119 closer aa aaa e a a a R 121 Sena A Ab 122 SENADGTA PIEVIOUS TO MAD taa A aca 124 setstatuschangsEventallback accio a Sd asadas 126 SETONIINGEVENTCOIDOCK a acido tl acia abuts dra 127 setoflineEVentEdlBalkiuiiiniica A A a apes 128 setPowerOffEVENTE dIbaCk iii ES co 129 setCove rOkEVent Callback init Ao brea ada 130 seltCoverOpenEventEallbdiCk tirannen a a h eee wei ead a 131 setPaperOkEventCdllbOCk anios iio 132 setPaperNearEndEveniCallbaE Kirai AS EA arena atte athe 133 setPaperEndEventEallbda kia A w
112. lect printer using search function gt Selecting a printer using the search function p 31 Getting the printer search result p 31 e Stopping the printer search p 32 159 Opening a Device Port Use the Epsonlo class s open p 163 to open a device port Please refer to the following code Initialize the Epsonlo class Epsonlo mPort new Epsonlo int errStatus IoStatus SUCCESS Open the device port try Wi Fi Ethernet device mPort open DevType TCP 192 168 192 168 null null Bluetooth device mPort open DevType BLUETOOTH 00 00 12 34 56 78 null null USB device mPort open DevType USB dev bus usb 001 002 null getApplicationContext Exception handling catch EpsonloException e errStatus e getStatus Sending Data Use the Epsonlo class s write p 167 to send data to the printer Please refer to the following code Printing out Hello World Settings for sending String str Hello World r n byte data str getBytes int offset 0 int size data length int timeout 5000 int sizeWritten 0 int errStatus IoStatus SUCCESS try Send data sizeWritten mPort write data offset size timeout Exception handling catch EpsonIoException e errStatus e getStatus 160 Chapter5 Command Transmission Reception Receiving Data Use the Epsonlo clas
113. lement the notification destination method when events occur Register the printer status notification destination Use openPrinter p 114 to start monitoring of the printer status Notify the printer status to the event implemented in 2 ao AGON When printer status notification is ended it ends on the closePrinter p 121 of the Print Q class 41 42 Listener Interface List Q For details on the listener interface refer to API Reference p 51 which explains the notification destination registration API Function Printer status notification Event listener Notification destination method Notification destination registration API public interface StatusChangeEventListener extends EventListener void onStatusChangeEvent String deviceName int status setStatusChangeEventCallback p 126 Online notification public interface OnlineEventListener extends EventListener void onOnlineEvent String deviceName setOnlineEventCallback p 127 Offline notification public interface OfflineEventListener extends EventListener void onOfflineEvent String deviceName setOfflineEventCallback p 128 Power off notification public interface PowerOffEventListener extends EventListener void onPowerOffEvent String deviceName setPowerOffEventCallback p 129 Cover close notification public interface CoverOkEventListener extends EventListener voi
114. lt Specify the print data gt builder addText Hello t builder addText World n builder addCut Builder CUT_FEED catch EposException e int errStatus e getErrorStatus Chapter 3 Programming Guide To create a graphic print document To create a graphic print document for graphics store the android graphics Bitmap class in the command buffers with addlmage p 73 of the Builder class Use the programming example below for your reference import android content res Resources import android graphics Bitmap import android graphics BitmapFactory trey nitialize a Builder class instance Builder builder new Builder TM T88V Builder MODEL_ANK Create a print document Bitmap bmp BitmapFactory decodeResource getResources R drawable background builder addImage bmp 0 0 8 48 Builder PARAM DEFAULT builder addCut Builder CUT_FEED catch EposException e int errStatus e getErrorStatus For ways of graphic printing you can also print the graphics registered in the printer s NV memory Q For details refer to addLogo p 81 35 36 To create a page mode print document The page mode starts by storing addPageBegin p 92 of the Builder class into a command buffer Store the print area addPageArea p 94 and the print start position addPagePosition p 97 in command buffers Specify the print start position according
115. mage corresponds to 1 dot of the printer If transparent shading is included it is regarded as white x To print a raster image at high speed specify Builder ALIGN_LEFT for the addTextAlign p 59 and specify a multiple of 8 not exceeding the printer s paper width for the width parameter of this API When printing transmission images the printing speed may become slower Multiple tone printing is not supported in Page Mode Multiple tone graphic printing is supported in Standard Mode only Syntax public void addImage Bitmap data int x int y int width int height int color int mode int halftone double brightness throws EposException Parameter e data Specifies an instance of the android graphics Bitmap class e x Specifies the horizontal start position in the print area Specifies an integer from O to 65534 e y Specifies the vertical start position in the print area Specifies an integer from O to 65534 e width Specifies the width of the print area Specifies an integer from 1 to 65535 e height Specifies the height of the print area Specifies an integer from 1 to 65535 If the area specified by the x y parameters and the width height parameters extends beyond the 3 image size specified by the data parameter an EposException with ERR_PARAM contained in its error status occurs e color Specifies the color Builder COLOR_NONE Characters are not printed Builder COLOR_1 First color Build
116. mple PIOGIOIN iii di 15 EEE a EEE S T T T S E T E E 15 E Usage ENVIO MENE iii adds 16 Development ENVIONMEN nccocccccnonnncncononononccnnnnnnnnnnnonn rr rr ran nor rr nr nana rr rn rr rnon nr rra rro nn nr rr rnron en rr rrnnan ne EEES EEE 16 Pta a AA A ah PAE Ase cv eT ee 16 PR SA A O AAA 16 E Environmental ConstrUCtiON ooccccncconocccononononancncnnnnonancnnnnnnnonnnnnnrnnnnnnnnrrnnnnnnnnrrrrrrnnnannnnnnos 17 E How to Use the Program Sample oooocccccoccccnonccccnnncccnnnnnconannccnnnncnnnnnnnnnnnnn nn cnn nncrnnarrrnnannn 18 Search for Printers AN Printing 0 canina 18 Acquisition of Printer Model NAME ocoooccccinocnnnononnononononnnonononono non rrnono nor nr rn cono rr ren nono n rr rr rnone rr nr rrnonannnnss 25 Printer Selection Using NFC or QR COC wii ree rr 26 OR COMES Plis nee Ae AGS A a AAG eA A ee a 26 Programming GUI sida 27 E How to Incorporate the ePOS Print SDK for ANdroid ooccccccooocccccccccoonnccccnnnnanannnnnos 27 E ePOS Print SDK ii id ici 29 PALMS ra a dio 29 Programming PO Wii AAA A ean Alia AE 29 Advance Preparations USB CONNECTION ccccocccccnonnnnncnnonnnnnoconnnnnnnononn nn nro nono rr rrr ron rr rn rr ron r rn rr naaa nn nacos 30 Printer Selecto Mines innia e td a di ta 31 Print Document Creation occccocccccnononcnononnnonononono no nnnnnnn nr rn rr nono rr raro nn erre rra RR rre a rr non enn r rr nnnn rn nr rrananerrnnnn ns 34 Transmission of Print DOCUMENT eine aa nn nconoon
117. n Parameter e builder Specifies a Builder class instance For details on the Builder class refer to Builder class p 51 e timeout Specifies the transmission reception waiting timeout time Aajust the timeout time according to the specifications for the model communication interface and transmission data size Specifies an integer in the range 0 600000 in milliseconds e status The printer status when command transmission ended is set A combination of printer status settings is set For details refer to Printer Statuses and Actions to Take p 49 e battery The battery status when command transmission ended is set For details refer to Support Information by Printer p 170 If an exception occurs use getPrinterStatus p 141 with exception handling to acquire the Q printer status and getBatteryStatus p 142 for the battery status Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_ILLEGAL This API was called when communication had not started yet ERR_PROCESSING Could not execute process ERR_TIMEOUT Could not send all the data within the specified time ERR CONNECT Connection error occurred ERR_MEMORY Could not allocate memory ERR_OFF_LINE The printer was offline ERR_FAILURE An unspecified error occurred 122 Chapter 4 API Reference Example To send a command to th
118. n ias muna EAA 168 o A O 169 E List of Supported APIs for Each Printer Model oooooocccccconccccccccocoonccccononannnccnnnnonannnnnnos 169 E Support Information by Printer ooocccnncnnnnccnncccccnccccccccconcnncnnnnnannnannaan nono nn cnn cn nnnnnnncnnnnnnns 170 IM e A a A a nS erica cay aera as ie ates 170 MA e On 171 MITO iaa da AA A N AA eens 172 IVES o EREE E EEA tts cist tee tl eet Got E A tae teal A 173 IMP tts aia eit A ais BPRS Gute erent tae eas 174 MINER OO sects st 2 ease O de fata eels ushtu bch sider suns eePhnscah E 176 MePO0 Estaca A A lela e 178 IMP de e al E a edo dh enel ed eto to its de hk 180 MEU a a o ao 82 A A O os 83 MTI a Men eee ead 184 TIT 2O locas creas tee Maca tests teca a oat lalo tel lec dal th da dle ald ata 85 IMTS laa a a laa om ian tie SL 86 O e 187 MELB 2M lint eric Pretec o a A A A ees 88 TIMO Sl lates ste celts rites shear eo basil oe de ed inde e e atin y east tdo lt oles bd de a 89 ME CGUMONS iis ses lee eel A daa cada 190 If you Use the Printer from Multiple Mobile Terminals cccccccccscccccscsssccsseteesscsseeseessessseesssensees 190 E Open Source Software License Agreement ccecsecceeeseeeeeeseeeeeeneeeeeseeeeeeeeneeeeneneenes 192 Chapter Overview Overview This chapter describes the features of and the specifications for ePOS Print SDK for Android Overview of ePOS Print SDK The ePOS Print SDK for Android is an SDK aimed at development engineers who are
119. n is thrown with one of the following error values loStatus ERR_OPEN Open processing failed loStatus ERR_ILLEGAL User attempted to open a device that is already open loStatus ERR_PROCESSING Could not execute process loStatus ERR_PARAM Invalid parameter was passed loStatus ERR_MEMORY Could not allocate memory loStatus ERR_FAILURE An unspecified error occurred 165 Closes the specified device port Syntax public void close throws EpsonloException Exceptions When processing fails EpsonloException is thrown with one of the following error values loStatus ERR_ILLEGAL This API was called when no device port was open loStatus ERR_PROCESSING Could not execute process loStatus ERR_FAILURE An unspecified error occurred 166 Chapter5 Command Transmission Reception Sends data to a device port Syntax public int write byte data int offset int size int timeout throws EpsonloException Parameter e data The sending data buffer It stores data to be sent e offset Specifies the start position for sending data Please specify the offset value from the top of the sending data buffer e size Specifies the number of bytes to send If 0 is specified for size no data will be sent In such a case the return value will be 0 e timeout Specifies the time in milliseconds to wait for sending to complete The maximum value that can be specified is 600000 which equate
120. n with one of the following error values oStatus ERR_OPEN Open processing failed oStatus ERR_ILLEGAL User attempted to open a device that is already open oStatus ERR_PROCESSING Could not execute process oStatus ERR_PARAM Invalid parameter was passed oStatus ERR_MEMORY Could not allocate memory oStatus ERR_FAILURE An unspecified error occurred 164 Chapter5 Command Transmission Reception open Previous format Opens the specified device port Q Use open p 163 when communicating via a USB connection Syntax public void open int deviceType String deviceName String deviceSettings throws EpsonloException Parameter e deviceType Specifies the device type to open The following values can be specified devicetype DevType TCP Specify this when the printer to be opened will connect with Wi Fi Ethernet DevType BLUETOOTH Specify this when the printer to be opened will connect with Bluetooth e deviceName Specifies the identifier to locate the target device The following values can be speci fied deviceType Specified Value Devlype TCP One of the following can be specified e Pv4 IP address Example 192 168 192 168 e MAC address Example 01 23 45 67 89 AB e Printer host name Arbitrary string DevType BLUETOOTH BD address Example 01 23 45 67 89 AB e deviceSettings Specify null Exceptions When processing fails EpsonloExceptio
121. nal GS1 DataBar Expanded Stacked Composite Symbology Paper Cut Feeds paper to cutting position Drawer Kick Out Not supported Buzzer Optional Battery Supported Battery Status Upper 8 bits Battery Status Cause 0x30 The AC adapter is connected 0x31 The AC adapter is connected Lower 8 bits 0x30 Battery amount 0 real end 0x31 Battery amount 1 near end 0x32 Battery amount 2 0x33 Battery amount 3 0x34 Battery amount 4 DA Ol BatteryamountS sss 0x36 Battery amount 6 Q If Ox0000 is returned the battery status cannot be acquired 175 TM P60 58 mm 60 mm Interface Wi Fi Bluetooth Resolution 203 dpi x 203 dpi W x H Language ANK model Print Width 420 dots 432 dots Characters in a Line Font A ANK 35 characters ANK 36 characters Font B ANK 42 characters ANK 43 characters Font C ANK 52 characters ANK 54 characters Character Size Font A ANK 12 dots x 24 dots W x H Font B ANK 10 dots x 24 dots W x H Font C ANK 8 dots x 16 dots W x H Character Baseline Font A At the 21st dot from the top of the character Font B At the 21st dot from the top of the character Font C At the 15th dot from the top of the character Default Line Feed Space 30 dots Color Specification First color Page Mode Default Area 420 dots x 1200 dots W x H 432 dots x 1200 dots W x H Page Mode Maximum Area 420
122. ng g 0x00000200 pressed ON Print ST_MECHANICAL_ERR a es cid ave Eliminate the cause of the error and Ox00000400 turn the printer on again Print ST_AUTOCUTTER_ERR ps Fa An autocutter error occurred Turn the printer off immediately 0x00000800 2 Y A An unrecoverable error occurred Turn the printer off immediately Print ST_AUTORECOVER_ERR Ox00004000 An automatically recoverable error occurred The error status is automatically canceled when the temperature of the head drops as the time passes Print ST_RECEIPT_NEAR_END No paper in roll paper near end Feed paper into the printer Ox00020000 sensor Print ST_RECEIPT_END ie oe No paper in roll paper end sensor Feed paper into the printer Print ST_BUZZER 0x01000000 A buzzer is on only for applicable devices Waiting for label to be removed only for applicable devices Remove the label 49 Battery Status The battery status consists of the following 16 bits Ox0000 AA A A AAA AA A A Upper 8 bits Common battery status PP For details refer to Common battery status upper 8 bits 0 50 i Battery status exclusive by model Lower 8 bits s For details refer to Support Information by Printer p 170 0x0000 is returned if the battery status cannot be acquired or if the model does not Q support the battery status Common battery status upper 8 bits Battery Status Cause 0
123. ng procedure A Start the sample program For details refer to Environmental Construction p 17 2 Search for printers Tap Printer Discovery on the main screen Select Device Type to display a list of IP addresses Mac addresses Device nodes Printer names for the printers retrieved on the Printer List Tap the printer to use from Printer List displayed Tap Get Printer Name on the main screen Tap Get Printer Name og hh W The following will be displayed Content displayed Description Printer Name Displays the model name of the printer Language Displays the language specifications of the printer 25 26 Printer Selection Using NFC or QR Code Use the following procedure A Start the sample program For details refer to Environmental Construction p 17 2 Tap Quick pairing and Easy print by NFC QR code on the main screen 3 Select a printer by using the following method e Hold the smart device to the NFC device e Read the QR code using the camera Put the QR code inside the red frame in the camera preview 4 Tap Print to print QR Code Printing Use the following procedure A Start the sample program For details refer to Environmental Construction p 17 Tap Print QR code on the main screen Tap Find in the QR Code Printing window In Printer List the detected printers are displayed in list form Select the printer you want to use a kh ON Tap Print to pr
124. nnot be used if the printer is not provided with the buzzer Syntax public void addSound int pattern int repeat throws EposException Parameter e pattern Specifies the buzzer pattern Builder PATTERN_A Pattern A Optional Buzzer Builder PATTERN_B Pattern B Optional Buzzer Builder PATTERN_C Pattern C Optional Buzzer Builder PATTERN_D Pattern D Optional Buzzer Builder PATTERN_E Pattern E Optional Buzzer Builder PATTERN_ERROR Error sound pattern Optional Buzzer Builder PATTERN_PAPER_END Pattern when there is no paper Optional Buzzer Builder PATTERN_1 Pattern 1 Internal Buzzer Builder PATTERN_2 Pattern 2 Internal Buzzer Builder PATTERN_3 Pattern 3 Internal Buzzer Builder PATTERN_4 Pattern 4 Internal Buzzer Builder PATTERN_5 Pattern 5 Internal Buzzer Builder PATTERN_6 Pattern 6 Internal Buzzer Builder PATTERN_7 Pattern 7 Internal Buzzer Builder PATTERN_8 Pattern 8 Internal Buzzer Builder PATTERN_9 Pattern 9 Internal Buzzer Builder PATTERN_10 Pattern 10 Internal Buzzer Builder PARAM_DEFAULT Pattern A e repeat Specifies the number of repeats to 255 Number of repeats Builder PARAM_DEFAULT One time 106 Chapter 4 API Reference Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not alloc
125. oid addTextFont int font throws EposException Parameter e font Specifies the font TM printer separate setting Set value Description TM T88V lt lt MUSA ee TM U220 TM U330 lt lt Boa ae lt lt MUSEU Al Builder FONT_A default Font A Vv viv iv Y Y viv Builder FONT_B Font B Viv Vv Vv Vv Builder FONT_C Font C vw la Palo a Builder FONT_D Font D A rra ir e e z Builder FONT_E Font E A e a Tha Poe a Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Example To set the font B try Builder builder new Builder TM T88V Builder MODEL_ANK builder addTextFont Builder FONT_B Process catch EposException e int errStatus e getErrorStatus Chapter 4 API Reference addTextSmooth Adds the smoothing setting to the command buffer Syntax public void addTextSmooth int smooth throws EposException Parameter e smooth Specifies whether to enable smoothing Builder TRUE Specifies smoothing Builder FALSE default Cancels smoothing Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was
126. on you would like to use this SDK in as follows import com epson eposprint import com epson epsonio import com epson epos easyselect There is no need to define the easyselect package if Printer Easy Select is not used N Confirm that the target project s libs folder is in the Source tab of the target project s properties If not add libs to the build path using Add Folder With the target project selected from Eclipse s Package Explorer select Preferences in the Window menu The Preferences screen is displayed From the list on the left select Java Compiler The Compiler screen is displayed Set the Compiler compliance level to 1 6 and click Apply After that click Ok A A Double click AndroidManifest xml from Eclipse s Package Explorer A q Select the Permissions tab A B The Android Manifest Permissions screen is displayed Click the Add button A A Select Uses Permission and click the OK button Uses Permission is added to Permissions Select the permissions of functionalities attached to the added Uses Permission from the Name under Attributes for Uses Permission Functionality Name setting Wi Fi android permission INTERNET android permission BLUETOOTH Bluetooth android permission BLUETOOTH_ADMIN USB android permission USB There is one setting of permissions for functionalities that can be attached per Uses 3 P
127. one of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Example To specify the print area with the origin 100 50 a width of 200 dots and a height of 30 dots and print the characters ABCDE try Builder builder new Builder TM T88V Builder MODEL_ANK builder addPageBegin builder addPageArea 100 50 200 30 builder addText ABCDE builder addPageEnd Process catch EposException e int errStatus e getErrorStatus Chapter 4 API Reference addPageDirection Adds the page mode print direction setting to the command buffer Specifies the print direction in page mode This function can be omitted if rotation is not required N Syntax Use this API function by inserting it between addPageBegin p 92 and addPageEnd p 93 public void addPageDirection int dir throws EposException Parameter e dir Specifies the print direction in page mode Left to right Builder DIRECTION_LEFT_TO_RIGHT l o No rotation Data is printed from the top left default corner to the right Bottom to top Builder DIRECTION BOTTOM 10_ TOP ES rotation by 90 degrees Data is printed from the bottom left corner to the top Right to left Builder DIRECTION_RIGHT_TO_LEFT Rotation by 180 degrees Data is printed from the bottom right co
128. ost 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 2014 All rights reserved 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 mal AN function Q 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 functional 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 About this Manual Aim of the Manual This manual aims to provide development engineers with all the information necessa
129. ot allocate memory ERR_FAILURE An unspecified error occurred Example To start communication via Wi Fi Ethernet with the printer whose IP address is 192 168 192 168 Print printer new Print try printer openPrinter Print DEVTYPE_TCP 192 168 192 168 Process catch EposException e int errStatus e getErrorStatus 120 Chapter 4 API Reference closePrinter This ends communications with the printer and monitoring of printer status Syntax public void closePrinter throws EposException Exceptions When processing fails EposException is thrown with one of the following error values ERR_ILLEGAL This API was called when communication had not started yet ERR_PROCESSING Could not execute process ERR_FAILURE An unspecified error occurred Example Print printer new Print try printer openPrinter Print DEVTYPE_TCP 192 168 192 168 Process printer closePrinter catch EposException e int errStatus e getErrorStatus 121 Sends a print document created using the Builder class If you are using a Bluetooth connection it may not be able to detect the offline status NH and timeout errors may occur If you use the printer from multiple mobile terminals see the Cautions p 190 Syntax public void sendData Builder builder int timeout int status int battery throws EposExceptio
130. ot supported 173 TM P20 58 mm Interface Ethernet Wi Fi USB Resolution 203 dpi x 203 dpi W x H Country e ANK model e Japanese model e Simplified Chinese model e Traditional Chinese model e South Asian model Print Width 384 dots Characters in a Line Font A ANK 32 characters Font B ANK 42 characters Font C ANK 42 characters Font D ANK 38 characters Font E ANK 48 characters Character Size Font A ANK 12 dots x 24 dots W x H Font B ANK 9 dots x 24 dots W x H Font C ANK 9 dots x 17 dots W x H Font D ANK 10 dots x 24 dots W x H Font E ANK 8 dots x 16 dots W x H Character Baseline Font A At the 21st dot from the top of the character Font B At the 16th dot from the top of the character Font C At the 16th dot from the top of the character Font D At the 21st dot from the top of the character Font E At the 15th dot from the top of the character Default Line Feed Space 30 dots Color Specification First color Page Mode Default Area 384 dots x 2400 dots W x H Page Mode Maximum Area 384 dots x 2400 dots W x H Barcode UPC A UPC E EAN13 JAN13 EAN8 JAN8 CODE39 ITF CODABAR CODE93 CODE128 GS1 128 GS1 DataBar Omnidirectional GS1 DataBar Truncated GS1 DataBar Limited 6S1 DataBar Expanded 174 Appendix Two Dimensional Code 58 mm PDF417 QR Code MaxiCode G 1 DataBar Stacked GS1 DataBar Stacked Omnidirectio
131. pecifies an integer from O to 255 e key2 Specifies the key code 2 of an NV logo Specifies an integer from O to 255 Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Example To print a NV logo with the key code parameters specified as 48 48 try Builder builder new Builder TM T88V Builder MODEL_ANK builder addLogo 48 48 Process catch EposException e int errStatus e getErrorStatus 81 addBarcode Adds barcode printing to the command buffer Syntax public void addBarcode String data int type int hri int font int width int height throws EposException Parameter e data Specifies the barcode data as a string Specify a string that follows the barcode standard specified by the type parameter If the specified Q string does not conform to the standard a barcode will not be printed Barcode type When an 11 digit number is specified a check digit is auto matically added UPC A 2 a ee When a 12 digit number is specified the 12th digit is pro cessed as a check digit but the check digit is not validated Specify O as the first digit Specify the manufacturer code in the digits 2 to 6 UPC E Specify right align the item code in the digits 7 to 11 The
132. posException Parameter e devicelype Specifies the type for the device to start communication Print DEVTYPE_TCP Wi Fi Ethernet device Print DEVTYPE_BLUETOOTH Bluetooth device Print DEVTYPE_USB USB device e deviceName Specifies the identifier used for identification of the target device Specifies the following for each device type deviceType Specified Value One of the following can be specified e IPv4 IP address Example 192 168 192 168 e MAC address Example 01 23 45 67 89 AB e Printer host name Arbitrary string Print DEVTYPE_BLUETOOTH BD address Example 01 23 45 67 89 AB Print DEVTYPE_TCP Print DEVTYPE_USB Device node e When a printer s IP address is set as DHCP specify a MAC address or Q printer host name for deviceName e When Print DEVTYPE_TCP is selected for deviceType and a printer host name is specified for deviceName use in an environment in which it is possible to search for a printer host name from the DNS server 119 Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_OPEN e The port open process failed e The printer was already in use ERR_ILLEGAL An attempt was made to start communicating with the device with which communication had already started ERR_PROCESSING Could not execute process ERR MEMORY Could n
133. ption is thrown with one of the following error values WA EA Pee ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Example To print 2D Code try Builder builder new Builder TM T88V Builder MODEL_ANK builder addSymbol ABCDE Builder SYMBOL PDF417 STANDARD Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED builder addSymbol ABCDE Builder SYMBOL_QRCODE_MODEL 2 Builder LEVEL_Q Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED builder addSymbol 908063840 x1d850 x1d001 x1d x04 Builder SYMBOL _MAXICODE MODE 2 Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED builder addSymbol 0201234567890 Builder SYMBOL_GS1_ DATABAR STACKED Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED builder addSymbol 0201234567890 Builder SYMBOL_GS1 DATABAR STACKED OMNIDIRECTIONAL Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED builder addSymbol 01 02012345678903 Builder SYMBOL_GS1 DATABAR EXPANDED STACKED Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Process catch EposE
134. put log data to the device s storage try Log setLogSettings getApplicationContext Log LOG_ PERMANENT Log LOG_STORAGE null1 0 10 Log LOG_LOW catch EposException e int errStatus e getErrorStatus status 0 e getPrinterStatus To disable the log output function try Log setLogSettings getApplicationContext Log LOG_ PERMANENT Log LOG DISABLE null 0 10 Log LOG_ LOW catch EposException e int errStatus e getErrorStatus status 0 e getPrinterStatus 156 Chapter 4 API Reference How to Extract a Log File Save destination Android Version Save destination storage path Android data application package name files EposLog Android Version 4 1 or lt Example gt earlier storage sdcard0 Android data com example files EposLog storage emulated index referring to usen Android data application pack Android Version 4 2 or age name files EposLog later lt Example gt storage emulated 0 Android data com example files EposLog File name d EposLog xx How to read a log Log format A log record is configured in the following format lt lt date and time process ID thread ID input and output layer input and output direction input and output data gt gt Date and time In yyyy mm da h mm ss 000 format Process ID thread ID ID of each process Layer at which data is input and output Input and output layer
135. r Print Characters 2 Specifies the character properties for the string to print The following properties can be specified Font Set the character font Align Set the alignment Line Spacing Set the line feed space Language Set the language Size Set the character scales vertical horizontal Style Set the character style bold underlining X Position Set the horizontal start position Feed Unit Set the paper feed amount 3 Tap Print to print Graphic printing Execute the graphic printing according to the following procedure A Tap Select Image to select an image file to print 2 Tap Color Mode to select the tone Gray 16 multiple tone printing can only be selected on the TM T88V TM T7OII TM Q T90II model Tap Halftone Method to select the halftone treatment method Es Tap Brightness and input a value to specify brightness A Tap Print to print al Barcode printing Chapter 2 Sample Program Execute the barcode printing according to the following procedure A Set the following for barcodes Description Type Select the barcode type Data Enter the barcode data HRI Set the HRI position Font Set the HRI font Module Size Width Height Set the barcode module size width height 2 Tap Print to print 2D Code printing Execute the 2D Code printing according to the following procedure
136. r TM T88V Builder MODEL_ANK builder addPulse Builder DRAWER_1 Builder PULSE_100 Process catch EposException e int errStatus e getErrorStatus 103 addSound Adds the turning on of the buzzer to the command buffer Sets the buzzer Not available in page mode Q The buzzer function and the drawer cannot be used together This API function cannot be used if the printer is not provided with the buzzer Syntax public void addSound int pattern throws EposException int repeat int cycle Parameter e pattern Specifies the buzzer pattern Builder PATTERN_A Pattern A Optional Buzzer Builder PATTERN_B Pattern B Optional Buzzer Builder PATTERN_C Pattern C Optional Buzzer Builder PATTERN_D Pattern D Optional Buzzer Builder PATTERN_E Pattern E Optional Buzzer Builder PATTERN_ERROR Error sound pattern Optional Buzzer Builder PATTERN_PAPER_END Pattern when there is no paper Optional Buzzer Builder PATTERN_1 Pattern 1 Internal Buzzer Builder PATTERN_2 Pattern 2 Internal Buzzer Builder PATTERN_3 Pattern 3 Internal Buzzer Builder PATTERN_4 Pattern 4 Internal Buzzer Builder PATTERN_5 Pattern 5 Internal Buzzer Builder PATTERN_6 Pattern 6 Internal Buzzer Builder PATTERN_7 Pattern 7 Internal Buzzer Builder PATTERN_8 Pattern 8 Internal Buzzer Builder PATTERN_9 Pattern 9
137. r Values Error values are defined in the loStatus class Error Value Cause loStatus ERR_PARAM Invalid parameter was passed lt Example gt e An invalid parameter such as null was passed e A value outside the supported range was specified loStatus ERR_OPEN Open processing failed loStatus ERR_CONNECT Failed to connect to device lt Example gt e Failed to send data to the target device for a reason other than a timeout e Failed to receive data from the target device for a reason other than a timeout loStatus ERR_MEMORY Could not allocate the necessary memory for processing loStatus ERR_ILLEGAL legal method used lt Example gt e The API for sending and receiving data was called when the device port was not open e The printer search API was called again when a printer search was already in progress loStatus ERR_PROCESSING Could not execute process lt Example gt Could not get lock rights to the shared resource because the same process is currently being executed by another thread loStatus ERR_FAILURE An unspecified error occurred 162 Chapter5 Command Transmission Reception Command Transmission Reception API Reference The following classes are available for command transmission reception APIs Epsonlo class Class to transmit and receive data The following APIs are available open Opens the device port 163 a Opens the device port
138. ram This chapter describes how to use the sample program The sample program is provided as an Android application project for use with Eclipse 3 including the Java source files For an Android application for TM printers developed using ePOS Print SDK the following program is available Overview The Sample Program has the following functionality Sample Program Description lt ePOSPrintSample gt The following functions are implemented in the sample ance The sample program does not contain a functionality for BsiptsuDiscouejy turning text images barcodes etc e Searching for printers Open Close e Opening of port _ e Closing of port e Text printing Barcode 2D Code e Graphic printing image file printing e Barcode printing Hona ModE cui e 2D Code printing e Printing in page mode Get Status Get Printer Name Paper cutting es e Printer status acquisition e Acquisition of printer model name language information e Log output setting e Display of status event e Display of battery status event lt ePOSEasySelectSample gt Connects to a printer easily by using NFC or QR code e Obtain printer information using NFC Quick pairing and Easy print by NFC QR code e Obtain printer information using QR code ea e Analyze the obtained printer information e Open a port using the results of analysis e Create printer information QR code from printer search results
139. rinter Print printer new Print printer setOfflineEventCallback this try printer openPrinter Print DEVTYPE_TCP 192 168 192 168 Print TRUE Print PARAM DEFAULT Process catch EposException e int errStatus e getErrorStatus Chapter 4 API Reference setPowerOffEventCallback This registers the notification destination of power off events This refers to events that are notified when there is no response concerning printer status This API can be executed following execution of openPrinter p 114 Q e When this API is executed on multiple occasions the notification destination that is specified afterwards is overwritten Syntax public void setPowerOffEventCallback PowerOffEventListener target Parameter e target This specifies the object listener interface that has the notification destination method listener registration method If null is specified for either the method or target the noti fication destination registration is nullified Listener Interface public interface PowerOffEventListener extends EventListener Listener Registration Method void onPowerOffEvent String deviceName Parameter e deviceName The identifier IPv4 type IP address BD address Device node Printer host name of the device that is notified of power off event is set Example public class SampleActivity extends Activity implements OnClickList
140. rner to the left Top to bottom BIS RECIO NO O Bono cs eo eno a Data is printed from the top right corner to the bottom Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred 95 96 Example To print the characters ABCDE by rotati ng them 90 degrees clockwise try Builder builder new builder addPageEnd Process catch EposException e Builder TM T88V Builder MODEL_ANK builder addPageBegin builder addPageArea 100 50 30 200 builder addPageDirection Builder DIRECTION_TOP_TO_ BOTTOM builder addText ABCDE int errStatus e get ErrorStatus Chapter 4 API Reference addPagePosition Adds the page mode print position set area to the command buffer Specifies the print start position coordinates in the area specified by the addPageArea method S Syntax Use this API function by inserting it between addPageBegin p 92 and addPageEnd p 93 public void addPagePosition int x int y throws EposException Parameter e x Specifies the horizontal print position in dots Specifies an integer from O to 65535 e y Specifies the vertical print position in dots Specifies an integer from O to 65535 following To print a character
141. rs ANK 48 characters Font B ANK 46 characters ANK 64 characters Character Size Font A ANK 12 dots x 24 dots W x H Font B ANK 9 dots x 17 dots W x H Character Baseline Font A At the 21st dot from the top of the character Font B At the 16th dot from the top of the character Default Line Feed Space 30 dots Color Specification First color Page Mode Default Area 420 dots x 831 dots W x H 576 dots x 831 dots W x H Page Mode Maximum Area 420 dots x 1662 dots W x H 576 dots x 1662 dots W x H Barcode UPC A UPC E EAN13 JAN13 EAN8 JAN8 CODE39 ITF CODABAR CODE93 CODE128 GS1 128 GS1 DataBar Omnidirectional 6S1 DataBar Truncated GS1 DataBar Limited GS1 DataBar Expanded Two Dimensional Code PDF417 QR Code MaxiCode 6S1 DataBar Stacked GS1 DataBar Stacked Omnidirectional GS1 DataBar Expanded Stacked Composite Symbology Paper Cut Cut Feed cut Drawer Kick Out Supported Buzzer Optional Battery Not supported 187 TM T82Il 58 mm 80 mm Interface Ethernet USB Resolution 203 dpi x 203 dpi W x H Language e ANK model e Simplified Chinese model e Traditional Chinese model e South Asian model Print Width 420 dots 576 dots Characters in a Line Font A ANK 35 characters ANK 48 characters Font B ANK 46 characters ANK 64 characters Character Size Font A ANK 12 dots x 24 dots W x H Font B ANK 9 dots x 17 dots W x H Character B
142. ry for the construction and design of a printing system that uses ePOS Print SDK and for the development and design of printer applications Manual Content The manual is made up of the following sections Chapter 1 Overview Chapter 2 Sample Program Chapter 3 Programming Guide Chapter 4 API Reference Chapter 5 Command Transmission Reception Appendix List of Supported APIs for Each Printer Model Support Information by Printer Cautions Open Source Software License Agreement Contents A A ae A ee a ec ee AE ON E 3 Key TO SyMDOIS ts cia ae ela a A AAT aR ee SET AD A Ta 3 ME Restriction Of USE nennen did in 3 E About his Manual ocio arce 4 Aim OFtne Manual it A RU AD aioe aida a aT Ro bee Aaa AT 4 Manual Contenidos ei ESA asedio Pa 4 BE CONTSMUS iii dai iS 5 OVOIVIOW acsiiticda a aa Aa AEREE 9 E Overview of ePOS Print SDK ooococccononoccccccnoccoooncccononconanoncnnnnnnnnnnnnrnnnnnnrnnnrnnnnnnrrrrnnnnnnnsrnennnnn 9 FOOTUIGS aii en ia dd Dd dr e A ai 9 UN tada aio eames 10 E Operating Environment cooocccnncccncnancnononancnnnnancnonnn conc nnnnn cnn rr cnnn cerraran 11 Android Veritas dd vol iia orale 1 ANGrOld DEVICES ii Ai 1 O AN 11 DevelopmentENvIO Me rai as A AE aun 12 Contents in the PUCkaOge cooocccccccccccnoncccnnancnonancnnnnnnnconannrnnnnn cnn nn nrcrnnnr rc nera 13 PAIS it ade SE 3 Manta AAA A EA tr Aa oe 13 Sample POG Mis adi SA 13 BOwWAOAG aiaa aaa a a n 13 E RESHICTIONS iii A ERE A RRE 14 Sa
143. s passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred 77 Example 78 try Bitmap imageData null Builder builder new Builder TM T88V Process builder addImage imageData 0 0 256 256 Builder PARAM DEFAULT Builder MODE MONO Builder HALFTONE DITHER 1 0 Builder MODEL_ANK Process catch EposException e int errStatus e getErrorStatus To print an image 256 dots wide and 256 dots high in page mode try Bitmap imageData null Builder builder new Builder TM T88V Process builder addPageBegin builder addPagePosition 0 255 builder addImage imageData 0 0 256 256 Builder PARAM DEFAULT Builder MODE MONO Builder HALFTONE_DITHER 1 0 Builder MODEL_ANK builder addPageEnd Process catch EposException e int errStatus e getErrorStatus Chapter 4 API Reference addlmage Previous format Adds raster image printing to the command buffer Multiple tones cannot be printed When a Bluetooth device is connected white streaks may appear because printing by image data compression is not possible Prints the graphic in the android graphics Bitmap class Of the graphics in the android graphics Bitmap class makes the specified range into binary with the dither processing and converts it into raster image data 1 pixel of the ima
144. s s read p 168 to receive data from the printer Please refer to the following code Settings for receiving byte data new byte 256 int offset 0 int size 256 int timeout 5000 int sizeRead 0 int errStatus Receive data try sizeRead mPort read data Exception handling catch EpsonloException e errStatus e getStatus ToStatus SUCCESS ri offset size timeout Closing the Device Port Use the Epsonlo class s close p 166 to close the device port Please refer to the following code int errStatus Close the device port try mPort close Exception handling catch EpsonIoException e errStatus e getStatus ToStatus SUCCESS a 161 Exception handling A command transmission reception API generates a propriety exception with an integer int type parameter when an error occurs and notify the calling side of such an error Steps for Handling Use the EpsonloException class s getStatus p 149 to get the error value Please refer to the following code String str Hello World r n byte data str getBytes int offset 0 int size data length int timeout 5000 int sizeWritten 0 int errStatus IoStatus SUCCESS try sizeWritten mPort write data offset size catch EpsonloException e timeout Get error value errStatus e getStatus List of Erro
145. s to 10 minutes Take the transmission speed and volume of data to be sent into account when specifying Q the timeout value When the timeout value is too short the sending process will still continue until all the data has been sent while normal data sending is occurring even if the timeout value is exceeded e With a Bluetooth device there is a chance that the sending process will be blocked In such a case processing will not complete even if the specified timeout value elapses Return value Returns the number of bytes of data that were sent The printer did not necessarily receive the amount of data that the return value shows Q Ifthe amount of time specified in timeout is exceeded the returned return value is the number of bytes that were sent up to that point Exceptions When processing fails EpsonloException is thrown with one of the following error values loStatus ERR_ILLEGAL This API was called when no device port was open loStatus ERR_PROCESSING Could not execute process loStatus ERR_PARAM Invalid parameter was passed loStatus ERR_CONNECT Connection error occurred loStatus ERR_MEMORY Could not allocate memory loStatus ERR_FAILURE An unspecified error occurred 167 Receives data from a device port This API continues receiving until a receiving error occurs However if not even a single byte of NH data is received during the period specified
146. status using getPrinterStatus p 141 and the battery status using getBatteryStatus p 142 Use the programming example below for your reference lt Send data for confirmation gt Print printer new Print int status new int 1 int battery new int 1 status 0 0 battery 0 0 ry Create a print document Builder builder new Builder TM T88V Builder MODEL_ANK getApplicationContext builder addText Hello t builder addText World n builder addCut Builder CUT_FEED lt Send print data gt Wi Fi Ethernet device printer openPrinter mList getDeviceType mList getDeviceName Print TRUE Print PARAM DEFAULT Bluetooth device printer openPrinter Print DEVTYPE_BLUETOOTH 00 00 12 34 56 78 Print TRUE Print PARAM DEFAULT USB device printer openPrinter Print DEVTYPE_USB dev bus usb 001 002 Print TRUE Print PARAM_DEFAULT printer sendData builder 10000 status battery printer closePrinter catch EposException e Acquire the error status int errStatus e getErrorStatus Acquire the printer status status 0 e getPrinterStatus Acquire the battery status battery 0 e getBatteryStatus printer closePrinter 45 Search API Acquire the error status using getStatus p 149 of the EpsonloException class Use the programming example below for your reference int errStat
147. t builder addText World n catch EposException e getErrorStatus new Builder TM T88V Builder MODEL_ANK Chapter 4 API Reference addTextLang Adds the language setting to a command buffer Encodes the string specified by addText p 62 according to the language information specified by this API Specify the value according to the language specifications set for Builder class Constructor p 54 Syntax public void addTextLang int lang throws EposException Parameter e lang Specifies the target language Builder _LANG_EN default English ANK Builder LANG_JA Japanese Builder LANG_ZH_CN Simplified Chinese Builder LANG_ZH_TW Traditional Chinese Builder LANG_KO Korean Builder LANG_TH Thai South Asia specifications Builder LANG_VI Vietnamese South Asia specifications Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Example To set the language as English try Builder builder new Builder TM T88V Builder MODEL_ANK builder addTextLang Builder LANG EN Process catch EposException e int errStatus e getErrorStatus 63 64 addTextFont Adds the text font setting to the command buffer Syntax public v
148. tDeviceType mList getDeviceName USB device printer openPrinter mList getDeviceType mList getDeviceName null Print TRUE Print PARAM_DEFAULT USB device printer openPrinter mList getDeviceType mList getDeviceName getApplicationContext Print TRUE Print PARAM DEFAULT lt Send data gt printer sendData builder 10000 status lt Delete the command buffers gt if status 0 amp Print ST_PRINT_ SUCCESS Print ST_PRINT_SUCCESS builder clearCommandBuf fer lt End communication with the printer gt printer closePrinter catch EposException e int errStatus e getErrorStatus status 0 e getPrinterStatus printer closePrinter 37 Effective range of command buffers for setting The effective range of addXXX in the Builder class instance used for setting is from the time when addXXX is set until sendData is executed The set value is initialized each time sendData is executed Refer to the following Example Print printer new Print Builder builder null Builder builder new Builder TM T88V Builder MODEL_ANK builder addText Hello World n String for which the addTextFont setting is disabled builder addTextFont Builder FONT_A String for which the addTextFont setting is enabled builder addText Hello World n FONT_A printer sendData builder 10000 status builder addText Hello
149. tener interface that has the notification destination method listener registration method If null is specified for either the method or target the noti fication destination registration is nullified Listener Interface public interface PaperEndEventListener extends EventListener Listener Registration Method void onPaperEndEvent String deviceName Parameter e deviceName The identifier IPv4 type IP address BD address Device node Printer host name of the device that is notified of paper end event is set Example public class SampleActivity extends Activity implements OnClickListener PaperEndEventListener Process private void onPaperEndEvent String deviceName Process private void openPrinter Print printer new Print printer setPaperEndEventCallback this try printer openPrinter Print DEVTYPE_TCP 192 168 192 168 Print TRUE Print PARAM DEFAULT Process catch EposException e int errStatus e getErrorStatus Chapter 4 API Reference setDrawerClosedEventCallback This registers the notification destination of drawer closed events This refers to events that are notified when printer status indicates the drawer is closed When this API is executed on multiple occasions the notification destination that is specified This API can be executed following execution of openPrinter p 114 Q afterwards is overwritten
150. the printer search takes time to complete you might not receive any search results Q if you call the Finder class s getDevicelnfoList immediately after you call start 31 32 Stopping the printer search Use the Finder class s stop p 145 to stop searching for printers Please refer to the following code int errStatus IoStatus SUCCESS Stop search try Finder stop Exception handling catch EpsonIoException e errStatus e getStatus Selecting a printer using NFC Use parseNFC p 151 in the EasySelect class to analyze the NFC tag Use the programming example below for your reference Use the obtained results in openPrinter p 114 Override protected void onNewIntent Intent intent Receive NFC tag by onNewintent EasySelect easySelect new EasySelect Tag tag Tag intent getParcelableExtra NfcAdapter EXTRA_TAG Analyze NFC tag EasySelectInfo easySelectInfo easySelect parseNFC tag if null easySelectInfo fit is not NFC for EasySelect return try Print printer new Print Open the printer using analyzed data printer openPrinter esaySelectInfo deviceType easySelect printerName easySelectInfo macAddress Printing process Close the printer printer closePrinter Exception handling catch EposException e Process This function is used for NFC s
151. tion ERR_TIMEOUT printerStatus 0 e getPrinterStatus J Process if printerStatus 0 Print ST_PRINT_SUCCESS Print ST_PRINT_SUCCESS 141 getBatteryStatus Acquires the battery status from an exception that occurred in sendData p 122 Syntax public int getBatteryStatus Return value Returns the battery status For details refer to Support Information by Printer p 170 Example To acquire the battery status from EposException new int 1 new int 1 int printerStatus int batteryStatus printerStatus 0 0 batteryStatus 0 0 int timeout 1000 try printer sendData builder timeout printerStatus batteryStatus catch EposException e int errSratus e getErrorStatus if errStatus EposException ERR_TIMEOUT printerStatus 0 e getPrinterStatus batteryStatus 0 e getBatteryStatus if printerStatus 0 amp Print ST_PRINT_SUCCESS Print ST_PRINT_SUCCESS Process 142 Chapter 4 API Reference Printer Search API API to search for printers The following classes are available 1 Finder class p 143 1 EpsonloException class p 143 Finder class Class to search for printers The following APIs are available start Starts searching for printers 144 stop End communication with the printer 145 getDevicelnfoList 148 Getting the printer search result 128
152. to 10000 Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred 109 Example To set 60 mm label paper black mark try Builder builder 15 Process catch Epos Exception e int errStatus new Builder TM P60II builder addLayout Builder PAPER_TYPE_LABEL BM 15 15 0 e getErrorStatus Builder MODEL_ANK 600 O Detailed description T See below for the parameters that can be specified for each type of paper and the positions for those parameters Receipt Top position Label Cut Bottom edge of print area vii Top position pp Ss Cut 7 Bottom edge of label lt Black Mark gt Bottom edge of print area Standard ejecta Param J Receipt Set value eter Receipt Label Ko 0X21 Black mark Black mark A width 1 to 10000 1 to 10000 1 to 10000 1 to 10000 B height 0 O to 10000 O to 10000 O to 10000 C marginTop 0 9999 to 10000 O to 10000 9999 to 10000 D marginBottom 0 0 9999 to O 9999 to 10000 E offsetCut 0 9999 to 10000 O to 10000 O to 10000 F offsetLabel 0 0 0 O to 10000 110 Chapter 4
153. to the print data Then store APIs in command buffers and create print data For the page mode end store addPageEnd p 93 in a command buffer Use the programming example below for your reference For the string Hello World to create a print document based on the following settings e Page mode print area in dots Origin of horizontal axis 100 origin of vertical axis 50 width 200 height 100 e Page mode print positions in dots Horizontal print position 0 vertical print position 42 e Font FontA e Scale x 2 horizontal and x 2 vertical e Style Bold try nitialize a Builder class instance Builder builder new Builder TM T88V Builder MODEL_ANK Create a print document lt The page mode starts gt builder addPageBegin builder addPageArea 100 50 200 100 builder addPagePosition 0 42 lt Configure the print character settings gt builder addTextLang Builder LANG_EN builder addTextSmooth Builder TRUE builder addTextFont Builder FONT_A builder addTextSize 4 4 builder addTextStyle Builder FALSE Builder FALSE Builder TRUE Builder PARAM_ UNSPECIFIED lt Specify the print data gt builder addText Hello t builder addText World n lt The page mode ends gt builder addPageEnd builder addCut Builder CUT_FEED catch EposException e int errStatus e getErrorStatus Chapter 3
154. ttery status notification destination 139 EposException class Acquires the status during slowdown when an exception occurs in printing error or an API execution error occurs getErrorStatus Acquires the error status 140 getPrinterStatus Acquires the printer status 141 getBatteryStatus Acquires the battery status 142 53 54 Builder class Constructor Constructor for the Builder class Initializes a Builder class instance Use this constructor to use the log output function Syntax public Builder String printerModel int lang Context context throws EposException Parameter e printerModel Specifies the model name for the target printer TM T88V TM T88V TM T70 TM T70 TM T7Oll TM T7Oll TM U220 TM U220 TM P20 TM P20 TM P60 TM P60 TM P6OII TM P60Il TM P80 TM P80 TM T20 TM 120 TM T20I1 TIM T20I TM T8111 TM T81II TM T82 TM T82 TM T82II TM T82Il TM T9OII TM T90II Chapter 4 API Reference e lang Specifies the language specifications for the printer TM printer separate setting ro Set value Printer model N 5 gt Builder MODEL_ANK ANK YVI viv vv v v Vv Builder MODEL JAPANESE Japanese Vivivv vVI V 1 vV Builder a MODEL CHINESE Simplified Chinese ViIVvivV viv iv v9 Vv punar Tra
155. uilder TM P60 builder addPageBegin builder addPageLine 100 0 500 0 builder addPageEnd Process catch EposException e int errStatus e getErrorStatus Builder MODEL_ANK Builder LINE_THIN 99 100 addPageRectangle Adds rectangle drawing in page mode to the command buffer Draws a rectangle in page mode 2 Use this API function by inserting it between addPageBegin p 92 and addPageEnd p 93 Syntax public void addPageRectangle int x1 int yl int x2 int y2 int style throws EposException Parameter e xl Specifies the horizontal start position of the line in dots Specifies an integer from O to 65535 e yl Specifies the Specifies an vertical start position of the line in dots integer from O to 65535 e x2 Specifies the horizontal end position of the line in dots Specifies an integer from O to 65535 e y2 Specifies the vertical end position of the line in dots Specifies an integer from O to 65535 e style Specifies the line type Builder LINE_THIN Solid line Thin Builder LINE_MEDIUM Solid line Medium Builder LINE_THICK Solid line Thick Builder LINE_THIN_DOUBLE Double line Thin Builder LINE_MEDIUM_DOUBLE Double line Medium Builder LINE_THICK_DOUBLE Double line Thick Builder PARAM_DEFAULT Solid line Thin Exceptions When processing fails EposException is thrown with on
156. uilder TRUE Process catch EposException e int errStatus e getErrorStatus Builder MODEL_ANK Builder TRUE 66 Chapter 4 API Reference addTextSize Adds the text scale setting to the command buffer Syntax public void addTextSize int width int height throws EposException Parameter e width Specifies the horizontal scale of text Set value Description Integer from 1 to 8 Horizontal scale default 1 O Retains the current setting e height Specifies the vertical scale of text Set value Description Integer from 1 to 8 Vertical scale default 1 Builder PARAM_UNSPECIFIED Retains the current setting Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed A ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Example To set a horizontal scale of x 4 and a vertical scale of x 4 try Builder builder new Builder TM T88V Builder MODEL_ANK builder addTextSize 4 4 Process catch EposException e int errStatus e getErrorStatus 67 addTextStyle Adds the text style setting to the command buffer Syntax public void addTextStyle int reverse int ul int em int color throws EposException Parameter e reverse Specifies
157. upported models only x Chapter 3 Programming Guide Selecting a printer using QR code Use parseQR p 151 in the EasySelect class to analyze the QR code Use the programming example below for your reference Use the obtained results in openPrinter p 114 EasySelect easySelect new EasySelect String data Store the QR code data obtained from the camera image Analyze the QR code EasySelectInfo ay easySelect parseQR data if null easySelectInfo vit it is not QR code for EasySelect return try Print printer new Print Open the printer using analyzed data printer openPrinter easySelectInfo deviceType easySelectInfo macAddress Create an Builder class instance by using the analyzed data Builder builder new Builder easySelectInfo printerName Builder MODEL_ JAPANESE printer closePrinter Exception handling catch EposException e Process How to Create Printer Easy Select QR code For models that can automatically print Printer Easy Select QR code Use the QR code for dynamic status sheets For details on how to print dynamic status sheets refer to the Technical Reference Guide of each model For models that cannot automatically print Printer Easy Select QR code Create QR code using createQkR p 152 Refer to QR code creation in the sample program 33 34 Print Document Creation Create a print document using the Builder
158. us IoStatus SUCCESS DeviceInfo mList null Acquire a list of devices try WWi Fi Ethernet device Finder start getBaseContext DevType TCP 255 255 255 255 Bluetooth device Finder start getBaseContext DevType BLUETOOTH null USB device Finder start getBaseContext DevType USB null mList getDeviceInfoList FilterOption PARAM DEFAULT Exception processing catch EpsonloException e errStatus e getStatus 46 Chapter 3 Programming Guide Error Statuses and Actions to Take Error statuses are defined in each APl executing class This section describes the details of error statuses and actions to take so that error handling can be performed in your application Invalid parameter was passed lt Example gt ERR PARAM e An invalid parameter such as null was me parameter was specified passed incorrectly Check the parameter e A value outside the supported range was specified Open processing failed lt Example gt Check the Android device and the ERR_OPEN e een not connect to the designated piniet o printer The printer s power condition e When attempting to connect via USB communication condition etc the USB cable was not connected Execute the closePrinter method and then the openPrinter method to restore the communication between the Android device and the printer When Bluetooth is selected for the Failed to connect
159. us acquisition and timeout cannot be set closePrinter End communication with the printer 121 sendData Sends a command to the printer 122 f Sends a command to the printer sendData Previous format 124 The battery status cannot be acquired setStatusChangeEventCallback Registers the printer status notification destination 126 setOnlineEventCallback Registers the online event notification destination 127 setOfflineEventCallback Registers the offline event notification destination 128 setPowerOffEventCallback Registers the power off event notification destination 129 setCoverOkEventCallback Registers the cover close event notification destination 130 setCoverOpenEveniCallback Registers the cover open event notification destination IS setPaperOkEventCallback Registers the paper OK event notification destination 132 Registers the paper near end event notification destina setPaperNearEndEventCallback Hor 1s setPaperEndEventCallback Registers the paper end event notification destination 134 setDrawerClosedEventCallback Registers the drawer close event notification destination 189 setDrawerOpenEventCallback Registers the drawer open event notification destination 136 setBatteryLowEventCallback Registers the battery low event notification destination 137 setBatteryOkEventCallback Registers the battery OK event notification destination 138 tBatt tatusCh Event lt SO Registers the ba
160. uthorized 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 e 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 Android js either registered trademarks or trademarks of Google Inc in the United States and other coun tries Java is a registered trademark of Oracle Corporation its subsidiaries and affiliates in the U S and other countries Wi Fi is a registered trademark of the Wi Fi Alliance Bluetooth is a registered trademark of Bluetooth SIG Inc Eclipse is a trademark or registered trademark of Eclipse Foundation Inc QR Code is a registered trademark of DENSO Wave Incorporated All other trademarks are the property of their resoective 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 patentpending commands ESC POS is compatible with most EPSON POS printers and displays ESC POS is designed to reduce the processing load on the h
161. x30 The AC adapter is connected 0x31 The AC adapter is not connected API Reference This chapter describes the APIs provided in the ePOS Print SDK for Android ePOS Print API The ePOS Print APIs are APIs for creating and printing print documents The following classes are available T Builder class p 51 1 Print class o 53 T EposException class p 53 Chapter 4 API Reference Q by Printer p 170 The APIs that you can use and the settings that you can designate vary based on the printer For details refer to List of Supported APIs for Each Printer Model p 169 and Support Information Builder class This class creates print documents for printer control commands such as character strings to print graphic printing and paper cutting The following APIs are available API Constructor Initialize a Builder class instance 54 l Initialize a Builder class instance Constructor Previous format j 56 The log output function cannot be used Clearing clearCommanaBuffer Clears the command buffers added by APIs 58 command buffers addTextAlign Adds a tag for the text alignment setting 59 addTextLineSpace Adds a tag for the line feed space setting 60 adaTextRotate Adds a tag for the text rotation setting l addText Adds a tag for printing text 62 addTextLang Adds a tag for the target language setting 63 addTextFont Adds a tag for the text
162. xception e int errStatus e getErrorStatus 91 addPageBegin 92 Adds the switching to page mode to the command buffer The page mode process starts Q Syntax public void addPageBegin throws EposException Use this API function with addPageEnd p 93 Exceptions When processing fails EposException is thrown with one of the following error values Description ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Example To print the characters ABCDE in page mode try Builder builder new Builder TM T88V Builder MODEL_ANK builder addPageBegin builder addText ABCDE builder addPageEnd Process catch EposException e int errStatus e getErrorStatus Chapter 4 API Reference addPageEnd Adds the end of page mode to the command buffer The page mode process ends N Syntax public void addPageEnd throws EposException Use this API function with addPageBegin p 92 Exceptions When processing fails EposException is thrown with one of the following error values Description ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Example To print the characters ABCDE in page mode try Builder builder new Builder TM T88V Builder MODEL_ANK builder addPageBegin builder addText ABCDE builder
163. y loStatus ERR_FAILURE An unspecified error occurred 147 148 getResult Previous format Gets the printer search result until the time when this API was called 2 This API cannot acquire Bluetooth devices or USB devices that are already open Syntax public static synchronized final String getResult throws EpsonloException Return value The list of devices found during search is returned Identification information of the found devices is stored as a character string String type in the list The stored results differ depending on the type of device deviceType deviceType Listto Acquire DevType TCP List of IP addresses of printers DevType BLUETOOTH List of BD addresses of Bluetooth devices DevType USB List of device node of USB devices Exceptions When processing fails EpsonloException is thrown with one of the following error values Error Value Description loStatus ERR_ILLEGAL This API was called when a search was not in progress loStatus ERR_PROCESSING Could not execute process loStatus ERR_MEMORY Could not allocate memory loStatus ERR_FAILURE An unspecified error occurred Chapter 4 API Reference Gets the error value of the exception Syntax public int getStatus Return value Returns the error value that is thrown with the exception Error values are defined in the loStatus class Error Value Cause loStatus ERR_PARAM

Download Pdf Manuals

image

Related Search

Related Contents

User's Manual  Samsung 730BF Užívateľská príručka  openTCS 2.5 - User manual  MS-168C INSTRUCTION MANUAL  MSDS  General Spin-Thru & Power Spin  Discproducer PP    FAG Alignment Tools Top-Laser: SMARTY2  

Copyright © All rights reserved.
Failed to retrieve file