Home
ePOS-Print SDK for Android User`s Manual
Contents
1. Builder Class Constructor 48 Constructor Forlog output 5 clearCommancBuffer 52 addTextAlign 53 addTextlineSpace 54 addTextRotate 55 addText 56 addTextLang 57 addTextFont 58 addlextSmooth 59 adaTextDouble 60 adaTextsSize 61 adaTextStyle 62 adaTextPosition 64 addFeedunit 65 addFeedLine 66 addalmage For multiple tone printing 67 adalmage 70 addLogo 72 addBarcode 73 addSymbol 78 addPageBegin 83 addPageEnd 84 addPageArea 85 addPageDirection 87 addPagePosition 89 addCut 95 adaPulse 96 addSounal For setting cycle buzzer 97 addSound Q addCommand 104 Print Class Constructor 105 Constructor For log output 106 openPrinter es acquiring printer status en Pp tee i closePrinter 111 sendData 112 setStatusChangeEventCallback 116 setOnlineEventCallback 118 setOfflineEventCallback 120 setPowerOffEventCallback 122 setCoverOkEveniCallback 124 setCoverOpenEventCallback 126 setPaperOkEventCallback 128 setPaperNearEndEventCallback 180 setPaperEndEventCallback 132 setDrawerClosedEventCallback 134 setDrawerOpenEventCallback 136 EposException Class getErrorStatus 144 getPrinterStatus 145 All the command transmission reception APIs are supported NQ 172 Appendix TM T9OII 80mm Interface Ethernet Wi Fi Resolution Japanese 203 dpi x 203
2. A A Top position a i E A AS als i Cut 7 t Receipt B A i A Cut a O _ _ _ _ IS Top position B Bottom edge B Bottom edge DE of print area DFiE Cut of print area y Standard ejecta Y dy Sano 3 A Soe Bottom edge j of label eter Set value Param i 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 103 addCommand Adds commands to the command buffer Sends ESC POS commands Q Syntax public void addCommand byte data throws EposException ESC POS commands are not made public For details contact the dealer 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
3. Chapter 4 API Reference addSound For setting cycle buzzer Adds the turning on of the buzzer to the command buffer Sets the buzzer Not available in page mode AN 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 int repeat int cycle throws EposException Parameter e pattern Specifies the buzzer pattern Builder PATTERN_A Pattern A Builder PATTERN_B Pattern B Builder PATTERN_C Pattern C Builder PATTERN_D Pattern D Builder PATTERN_E Pattern E Builder PATTERN_ERROR Error sound pattern Builder PATTERN_PAPER_END Pattern when there is no paper Builder PATTERN_1 Pattern 1 Builder PATTERN_2 Pattern 2 Builder PATTERN_3 Pattern 3 Builder PATTERN_4 Pattern 4 Builder PATTERN_5 Pattern 5 Builder PATTERN_6 Pattern 6 Builder PATTERN_7 Pattern 7 Builder PATTERN_8 Pattern 8 Builder PATTERN_9 Pattern 9 Builder PATTERN_10 Pattern 10 Builder PARAM_DEFAULT Pattern A e repeat Specifies the number of repeats 1 to 255 Number of repeats Builder PARAM_DEFAULT One time 97 e cycle This specifies the buzzer sounding cycle in units of milliseconas Set value Description 1000 to 25500 1000 to 25500 milliseconds Builder PARAM_DEFAULT 1000 milliseconds Pattern A to E
4. 67 e mode Specify the color mode TM printer separate setting Set value Description Builder MODE_MONO Monochrome vivivivivvlvivivivv 2 tone Baida mone enavo Ten yl elel l l l l l l 2 16 tone Specify the half tone treatment Builder PARAM_DEFAULT method viviv v vivi v vivi v 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 A e brightness Specify the correction value for brightness Set value Description 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 A 68 Chapter 4 API Reference Exceptions When processing fails EposException is thrown with one of the following error values ee A E AA AAA ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An
5. 156 Chapter 5 Command Transmission Reception Receiving Data Use the Epsonlo class s read p 164 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 EpsonIoException e errStatus e getStatus ToStatus SUCCESS f offset size timeout Closing the Device Port Use the Epsonlo class s close p 161 to close the device port Please refer to the following code int errStatus Close the device port try mPort close Exception handling catch EpsonloException e errStatus e getStatus ToStatus SUCCESS r 157 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 151 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 Epsonlo
6. 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 Chapter 4 API Reference addSound Adds the turning on of the buzzer to the command buffer Sets the buzzer If you want to optionally set the buzzer sounding cycle milliseconds use addSound For setting Q cycle buzzer p 97 Not available in page mode NM 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 int repeat throws EposException Parameter e pattern Specifies the buzzer pattern Builder PATTERN_A Pattern A Builder PATTERN_B Pattern B Builder PATTERN_C Pattern C Builder PATTERN_D Pattern D Builder PATTERN_E Pattern E Builder PATTERN_ERROR Error sound pattern Builder PATTERN_PAPER_E
7. A command transmission reception API cannot be used with the Print class p 47 of ePOS Print API Programming Programming Flow Perform programming following this flow 1 Printer search p 30 A Starting the printer search p 30 l A Getting the printer search result 0 30 AU Stopping the printer search p 30 2 Opening a Device Port p 156 3 Sending Data p 156 4 Receiving Data p 157 5 Closing the Device Port p 157 This is optional 155 Opening a Device Port Use the Epsonlo class s open p 159 to open a device port Please refer to the following code Initialize the Epsonlo class Epsonlo mPort new Epsonlo int errStatus ToStatus SUCCESS Open the device port try mPort open DevType TCP 192 168 192 168 null Exception handling catch EpsonIoException e errStatus e getStatus Sending Data Use the Epsonlo class s write p 162 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
8. 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 Error Value Description 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 164 Appendix Appendix Printer specifications TM T88V 58mm 80mm Interface Ethernet Wi Fi Resolution 180 dpi x 180 dpi W x H Language e ANK model e Japanese model e Chinese model e Taiwanese 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
9. 93 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 94 try Builder builder new Builder TM P60 builder addPageBegin builder addPageRectangle 100 0 500 builder addPageEnd Process catch EposException e int errStatus e getErrorStatus Builder MODEL_ANK 200 Builder LINE_THIN Chapter 4 API Reference addCut Adds paper cut to the command buffer Sets paper cut A Syntax Not available in page mode public void addCut int type throws EposException Parameter e type Specifies the paper cut type Cut without feeding Builder CUT_NO_FEED z The paper is cut without being fed Feed cut Builder CUT_FEED w 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 e 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 ERR_FAILURE An unspecified error occurred Example To perform feed cut operation try Builder builder new Builder TM T88V Builder
10. Acquires the status during slowdown when an exception occurs in printing error or an API execution error occurs getErrorStatus Acquires the error status 144 getPrinterStatus Acquires the printer status 145 getBatteryStatus Acquires the battery status 146 47 Builder class Constructor Constructor for the Builder class Initializes a Builder class instance N To use the log output function use the Builder class Constructor For log output p 50 Syntax public Builder String printerModel throws EposException Parameter int lang e printerModel Specifies the model name for the target printer TM T88V TM T88V TM T70 TM T70 TM T7OII TM T70Il TM U220 TM U220 TM P60 TM P60 TM P6OII TM P60ll TM T20 TM T20 TM T8111 TM T8111 TM T82 TM T82 TM T8211 TM T82ll TM T9OII TM T9OI e lang Set value Builder MODEL_ANK Specifies the language specifications for the printer ANK model Builder MODEL_JAPANESE Japanese model Builder MODEL_CHINESE Chinese model Builder MODEL_TAIWAN Taiwanese model Builder MODEL_KOREAN Korean model Builder MODEL_THAI Thai model Builder MODEL_SOUTHASIA South Asian model 48 Chapter 4 API Reference Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invali
11. catch EposException e int errSratus e getErrorStatus if errStatus EposException ERR_TIMEOUT printerStatus 0 e getPrinterStatus if printerStatus 0 amp Print ST_PRINT_SUCCESS Print ST_PRINT_SUCCESS Process 145 getBatteryStatus Acquires the battery status from an exception that occurred in sendData For acquiring battery status p 114 Syntax public int getBatteryStatus Return value Returns the battery status For details refer to Printer specifications p 165 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 146 Chapter 4 API Reference Printer Search API API to search for printers The following classes are available 1 Finder class p 147 T EpsonloException class p 147 Finder class Class to search for printers The following APIs are available start Starts searching for printers 148
12. 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 148 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 149 150 getResult Gets the printer search result until the time when this API was called 2 This API cannot acquire Bluetooth 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 MAC addresses of Bluetooth devices Exceptions When processing fails EpsonloException is thrown with
13. 118 setOnlineEventCallback This registers the notification destination of online events This refers to events that are notified when printer status is online p 107 When this API is executed on multiple occasions the notification destination that is specified afterwards is overwritten 2 This API can be executed following execution of openPrinter For acquiring printer status 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 soecified 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 MAC address of the device that is notified of online event is set Chapter 4 API Reference 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 printer openPrinter Print DEVTYPE_TCP 192 168 192 168 Print TRUE Print PARAM_DEFAULT Process catch
14. Interface Ethernet Wi Fi Resolution 160 dpi x 72 dpi W x H Language e ANK model e Japanese model e Chinese model e Taiwanese model e Korean model e Thai model e South Asian model Print Width 400 or 385 dots 360 dots 300 or 297 dots Characters in a Line Font A ANK 40 characters ANK 36 characters ANK 30 characters Font B ANK 33 characters ANK 30 characters ANK 25 characters Character Size Font A ANK 7 dots x 9 dots W x H Font B ANK 9 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 Bar Code Not supported Two Dimensional Code Not supported Paper Cut Cut No cut Drawer Kick Out Supported Buzzer Not supported Battery Not supported 181 List of Supported ePOS Print APIs ePOS Print API ePOS Print API Builder Class Constructor 48 Constructor Forlog output 5 clearCommanaBuffer 52 addTextAlign 53 addTextLineSpace 54 addlextRotate 55 addText 56 addTextLang 57 addTextFont B8 addlextStle 62 addFeedunit 65 addFeedLine 66 addlImage For multiple tone printing 67 adalmage 70 addCut 95 adaPulse 96 addCommand 104 Print Class Constructor 105 Constructor For log output 106 O printer status 1o i ne closePrinter 111 sendData 1112 setStatusChangeEventCallback 116 setOnlineE
15. int errStatus e getErrorStatus OG 139 140 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 p 107 When this API is executed on multiple occasions the notification destination that is specified afterwards is overwritten 2 This API can be executed following execution of openPrinter For acquiring printer status 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 soecified 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 MAC address of the device that performed battery OK event notification is set Chapter 4 API Reference Example public class SampleActivity extends Activity implements Process private void onBatteryOkEvent String deviceName Process private void openPrinter Print printer new Print printer setBatteryOkEventCallback
16. stop End communication with the printer 149 getResult Getting the printer search result 150 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 159 The following APIs are available getStatus Acquires an error value of an exception 151 147 Starts a search for printers of the specified device type e f you use this API be sure to use stop p 149 to stop the search AN You cannot call this API when a printer search is already in progress Syntax public static synchronized void start Context context int deviceType String findOption throws EpsonloException Parameter e context Set a Context class instance of caller Example Set the Context acquired by getBaseContext in Activity e devicelype 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 Bev ESC of Printer or Uncategorized e findOption 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 Exceptions When processing fails EpsonloException is thrown with one of the following error values
17. this try printer openPrinter Print DEVTYPE_TCP 192 168 192 168 Print PARAM DEFAULT Process catch EposException e int errStatus e getErrorStatus OnClickListener BatteryOkEventListener Print TRUI OG 141 setBatteryStatusChangeEventCallback This registers the notification destination of battery status This API can be executed following execution of openPrinter For acquiring printer status p 107 Q e When this API is executed on multiple occasions the notification destination that is specified 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 soecified 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 e deviceName The identifier IPv4 type IP address MAC address of the device that is notified of bat tery status is set e battery Battery status is set Chapter 4 API Reference Example public class SampleActivity extends Activity implements OnClickListener Batte
18. 169 TM T7Oll 80mm Interface Ethernet Wi Fi 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 Chinese model e Taiwanese model e Korean model e South Asian model Print Width ANK 512 dots Other 576 dots Characters in a Line Font A ANK 42 characters Other 48 characters Font B ANK 56 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 chara 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 ANK 512 dots x 1662 dots WxH Other 576 dots x 1662 dots WxH Page Mode Maximum Area ANK 512 dots x 1662 dots WxH Other 576 dots x 1662 dots WxH Bar Code 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 6S1 DataBar Stacked GS1 DataBar Stacked Omnidirectional GS1 DataBar Expanded Stacked 170 Appendix 80mm Paper Cut Cut Feed cut Drawer Kick Out Supported Buzzer Supported Battery Not supported 171 List of Supported ePOS Print APIs ePOS Print API ePOS Print API
19. 65 addFeedLine 66 addalmage For multiple tone printing 67 adalmage 70 addLogo 72 addBarcode 73 addSymbol 78 addPageBegin 83 addPageEnd 84 addPageArea 85 addPageDirection 87 addPagePosition 89 addCut 95 adaPulse 96 ICAA A fT Print Class Constructor 105 Constructor Forlogoutput T 106 openPrinter es acquiring printer status lor Sepia a closePrinter 111 sendData 112 setStatusChangeEventCallback 116 setOnlineEventCallback 118 setOfflineEventCallback 120 setPowerOffEventCallback 122 setCoverOkEventCallback 124 setCoverOpenEventCallback 126 setPaperOkEventCallback 128 setPaperNearEndEventCallback 180 setPaperEndEventCallback 132 setDrawerClosedEventCallback 134 setDrawerOpenEventCalloack 136 EposException Class getErrorStatus 144 getPrinterStatus 145 All the command transmission reception APIs are supported Q 186 Appendix TM T82 58mm 80mm Interface Ethernet Resolution 203 dpi x 203 dpi W x H Language e 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 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
20. EposException e int errStatus e getErrorStatus 119 120 setOfflineEventCallback This registers the notification destination of offline events This is the notification method when printer is offline concerning printer status p 107 When this API is executed on multiple occasions the notification destination that is specified afterwards is overwritten 2 This API can be executed following execution of openPrinter For acquiring printer status 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 soecified 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 MAC address of the device that is notified of offline event is set Chapter 4 API Reference Example public class SampleActivity extends Activity implements OnClickListener OfflineEventListener Process private void onOfflineEvent String deviceName Process private void openPrinter Print printer new Print printer setOfflineEventCallback this try pri
21. MODEL_ANK builder addCut Builder CUT_FEED Process catch EposException e int errStatus e getErrorStatus 95 addPulse Adds the drawer kick to the command buffer Sets the drawer kick Not available in page mode NM 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 Builder TM T88V Builder MODEL_ANK builder addPulse Builder DRAWER_1 Builder PULSE_100 Process catch EposException e int errStatus e getErrorStatus
22. Mac address displayed in procedure 2 Open the printer s port Tap Open on the main screen The Device Type and IP Address Mac Adaress of the printer selected in procedure 3 are displayed Select Printer Name and Language Set Status Monitor MS Description Enabled e ON The status monitor is enabled and the printer status is monitored nable e OFF The status monitor is disabled al When Enabled is turned ON the status monitoring interval is set in units of milliseconas Tap Open Chapter 2 Sample Program Y Execute the following processes Process Description Tap Text on the main screen Text printi ex1 printing For details refer to Text printing p 20 Tap Image on the main screen Graphi inti a A For details refer to Graphic printing p 20 Tap Barcode on the main screen B inti picede Pinta For details refer to Barcode printing p 21 Tap 2D Code on the main screen 2D inti Code eran For details refer to 2D code printing p 21 Tap Page Mode on the main screen Printing i d CA PR For details refer to Printing in page mode p 22 Tap Cut on the main screen P tti Clee nI For details refer to Paper cutting p 22 Tap Log Settings on the main screen L tput setti cis ci SSRS For details refer to Log output setting p 22 Printer status acquisition Tap Get Status on the main screen 8 The fol
23. 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 Bar Code 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 List of Supported ePOS Print APIs ePOS Print API ePOS Print API Builder Class Constructor 48 Constructor Forlog output 5 clearCommancBuffer 52 addTextAlign 53 addTextlineSpace 54 addTextRotate 55 addText 56 addTextLang 57 addTextFont 58 addlextSmooth 59 adaTextDouble 60 adaTextsSize 61 adaTextStyle 62 adaTextPosition 64 addFeedunit 65 addFeedLine 66 addalmage For multiple tone printing 67 adalmage 70 addLogo 72 addBarcode 73 addSymbol 78 addPageBegin 83 addPageEnd 84 addPageArea 85 addPageDirection 87 addPagePosition 89 addCut 95 adaPulse 96 addSounal For setting cycle buzzer 97 addSound Q addCommand 104 Print Class Constructor 105 Constructor For log output 106 open
24. QR Code Paper Cut Cut Feed cut Drawer Kick Out Supported Buzzer Not supported Battery Not supported 168 Appendix List of Supported ePOS Print APIs ePOS Print API ePOS Print API Builder Class Constructor 48 Constructor Forlog output 5 clearCommancBuffer 52 addTextAlign 53 adaTextlineSpace 54 addTextRotate 55 addText 56 addTextLang 57 addTextFont 58 addlextSmooth 59 adaTextDouble 60 adaTextsSize 61 addTextStyle 62 adaTextPosition 64 addFeedunit 65 addFeedLine 66 addalmage For multiple tone printing 67 adalmage 70 addLogo 72 addBarcode 73 addSymbol 78 addPageBegin 83 addPageEnd 84 addPageArea 85 addPageDirection 87 addPagePosition 89 addCut 95 adaPulse 96 addCommand 104 Print Class Constructor 105 Constructor Forlogoutput T 0 openPrinter pa acquiring printer status lor Sepia a closePrinter 111 sendData 112 setStatusChangeEventCallback 116 setOnlineEventCallback 118 setOfflineEventCallback 120 setPowerOffEventCallback 122 setCoverOkEventCallback 124 setCoverOpenEventCallback 126 setPaperOkEventCallback 128 setPaperNearEndEventCallback 180 setPaperEndEventCallback 132 setDrawerClosedEventCallback 134 setDrawerOpenEventCalloack 136 EposException Class getErrorStatus 144 getPrinterStatus 145 All the command transmission reception APIs are supported Q
25. application identifier Al in parentheses The parentheses are used as HRI print characters and are not encoded as data You can insert soaces between an application identifier GS 1 128 AD and data The spaces 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 1 FNC3 3 C 0 A e 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 74 Chapter 4 API Reference Barcode iype You can enclose an application identifier Al in parentheses The parentheses are used as HRI print characters and are not encoded as data BARCODE_GS1_ To encode each of the following characters specify two DATABAR_EXPANDED characters starting with the character FNC1 1 C K 0 To specify binary data that cannot be represented by character strings use the following escape sequences BECA SAL xnn Control 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 Bui
26. are laid out in the print positions coordinates Programming Flow Perform programming following this flow 1 Print Document Creation p 31 A Starting the printer search p 30 l l U Getting the printer search result p 30 l l A Stopping the printer search p 30 2 Print Document Creation p 31 A To create a text print document p 31 1 To create a graphic print document p 32 A To create a page mode print document p 33 3 Transmission of Print Document p 34 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 35 29 Printer search Starting the printer search Use the Finder class s start p 148 to start searching for printers Please refer to the following code int errStatus IoStatus SUCCESS Start search try Finder start getBaseContext DevType TCP 255 255 255 255 Exception handling catch EpsonIoException e errStatus e getStatus Getting the printer search result Use the Finder class s getResult p 150 to get the result of the printer search Please refer to the following code int errStatus IoStatus SUCCESS String mList null Get device list try mList Finder getResult Exception handling catch Eps
27. 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 86 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 Q Use this API function by inserting it between addPageBegin p 83 and addPageEnd p 84 Syntax 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 ar No rotation Data is printed from the top left default corner to the right Bottom to top Builder DIRECTION BOTTOM 10 TOP Ke CUM eI COC KISS 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 corner to the left Top to bottom Bd PRESION rro es scone Ses 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 ER
28. ccccccceccesessssseesssecceeseseeeeeeeeeeesesesesessessaueeanseeseeseesseeeeeeeess 17 El How to Use the Program Sample coooocccnnccccnnnnccccnnnnncnnancnnnnannnnnnn cnn aeaaaee anenai paR ietin inaa 18 Search for Printers ANA Printing nora rana rr rr rr 18 Acquisition of Printer Model NOMG s cic leadeovennte iedadin ean iter anidends ase EA A EE 25 Programming Guide amara coronaria arias 27 E How to Incorporate the ePOS Print SDK for ANdroid cccoccoooccccccocooocccccnnnnnnnnnnnnos 27 Mi EPOS Print SDK din doicadustteceiats 29 Print MOG6 O O 29 PIGGIEMMIAG FOW Siete sas n 29 Printer ads 30 Print Document Crea ons cascinnantawatdalanintuvatat E E E sa paw Aas haan 3 Transmission of Pint DOCU NO iii ta alentado ovata aan aeons 34 Printing After Checking the Printer StOfUS ooonoonncicnnncinnncoonrronanaro ro narnnororora raro ro rra rara rr 35 E Automatic Acquisition of Printer StQtUS ooooooccccdonanicccnnnnnoonnnnnnnnnnnnnncncnnnnanonnnnncnnnannnnnnos 36 Listener Interface sii A A ees 38 E Exception haONdlINO oocicirnmiririaici ic iii 40 Steps for HANGING id AAA A A AR RE AT 40 Eror OUCH US Mt as ad Oe Eee de 42 Printer STATUS LISA ri A cabal aid aie 43 BAM od do ed cl sige Gudea a O A r 44 API Reference naninita ai annann aaa aitaan e ar iia nakaa aTa 45 E ePOS Print AP ra iia A da did diia 45 Builder class CCONMSTUCTON aian anaiarik nr n rr tarat liant near aran RR Rara aa EACEA AAE PATEE TEE i
29. dpi W x H Language e Japanese model Print Width 576 dots Characters in a Line Font A 48 characters Font B 72 characters Font C 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 chara 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 576 dots x 1662 dots WxH Page Mode Maximum Area 576 dots x 1662 dots WxH Bar Code Codabar Code39 ITF JAN13 EAN JANS EAN UPC A UPC E Code93 Code128 GS1 128 6S1 DataBar Omni directional GS1 DataBar Truncated GS1 DataBar Expanded 6S1 DataBar Limited Two Dimensional Code PDF417 QRCode MaxiCode GS1 DataBar Stacked 6S1 DataBar Stacked Omni directional GS1 DataBar Expanded Stacked Paper Cut Cut Feed cut Drawer Kick Out Supported Buzzer Supported Battery Not supported 173 List of Supported ePOS Print APIs ePOS Print API ePOS Print API Builder Class Constructor 48 Constructor Forlogoutput 5 clearCommancBuffer 52 addTextAlign 53 adaTextlineSpace 54 addTextRotate 55 addText 56 addTextLang 57 adaTextFont 58 addText mooth 59 adaTextDouble 60 adaTextsSize 61
30. is specified the distance from the standard printing position to the next standard printing position is detected automatically Specifies the distance in units of 0 1mm from the standard printing position to the top position Specifies an integer from 9999 to 10000 Specifies the distance in units of 0 1mm from the standard eject position to the bot tom edge of the printable area Specifies an integer from 9999 to 10000 Specifies the distance in units of 0 1mm from the standard eject position to the cutting position Specifies an integer from 9999 to 10000 Specifies the distance in units of 0 1mm from the standard eject position to the bot tom edge of the label Specifies an integer from O to 10000 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 set 60mm label paper black mark try Builder builder new Builder TM P60II builder addLayout Builder PAPER_ TYPE LABEL BM 15 15 15 0 H Builder MODEL_ANK 600 O Process catch EposException e int errStatus e getErrorStatus Detailed description T See below for the parameters that can be specified for each type of paper and the positions for those parameters lt Black Mark gt
31. 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 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 e color Specifies the color Set value Description Builder COLOR_NONE Characters are not printed Builder COLOR_1 First color Builder COLOR_2 Second color Builder COLOR_3 Third color Builder COLOR_4 Fourth 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 Chapter 4 API Reference Exceptions When processing fails EposException is thrown with one of the following error values MESA AA gt ERR_PARAM Invalid parameter was passed ERR_MEMORY Could
32. 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 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 89 90 Example To specify 50 30 for the print start position in the area specified by the addPageArea method and print the characters ABCDE try of 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 Chapter 4 API Reference addPageLine Adas line drawing in page mode to the command buffer Draws a line in page mode A N Syntax Diagonal lines cannot be drawn Use this API function by inserting it between addPageBegin p 83 and addPageEnd p 84 public void addPageLine int x1 int yl int x2 int y2 int style throws EposExcept
33. 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 63 64 addTextPosition Adds the horizontal print start position of text to the command buffer 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
34. unauthorized modifications repairs or alterations to this product or excluding the U S failure to strictly comply with Seiko Epson Corporation s operating and maintenance instructions Seiko Epson Corporation shall not be liable against any damages or problems arising from the use of any options or any consumable products other than those designated as Original EPSON Products or EPSON Approved Products by Seiko Epson Corporation Trademarks EPSON and ESC POS are registered trademarks of Seiko Epson Corporation in the U S and other countries Android is either registered trademarks or trademarks of Google Inc in the United States and other countries Java Misa 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 ESC POS Command System EPSON has been taking industry s initiatives with its own POS printer command system ESC POS ESC POS has a large number of commands including patented ones Its high scalability enables users to build versatile POS systems The system is compatible with all types of EPSON POS printers excluding the TM C100 and displays Moreover its flexibility makes it easy to upgrade the future The functionality and the user friendliness
35. 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 builder new Builder TM T88V Builder MODEL_ANK builder addFeedUnit 30 Process catch EposException e int errStatus e getErrorStatus 65 66 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 For multiple tone printing Adas 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
36. was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Example To print barcodes Chapter 4 API Reference 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 UNSPECIFIED new Builder TM Builder PARAM UNSPECIFIED Builder BARCODE_EAN8 Builder BARCODE_JAN8 Builder BARCODE_CODE39 Builder BARCODE_ITF Builder BARCODE_CODABAR Builder BARCODE_CODE93 Builder BARCODE_CODE128 builder addBarcode 01 201234567890 T88V B
37. 00080000 Print ST_BUZZER e A buzzer is on only for applicable devices 0x01000000 e Waiting for label to be removed only for applicable devices 43 Battery Status The battery status consists of the following 16 bits Ox0000 A A Deseo e AA Common battery status PP For details refer to Common battery status upper 8 bits 0 44 a Battery SKIS eee by mecel For details refer to Printer specifications p 165 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 0x30 The AC adapter is connected 0x31 The AC adapter is not connected Chapter 4 API Reference 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 45 1 Print class p 47 d EposException class p 47 The APIs that you can use and the settings that you can designate vary based on the printer Q For details refer to Printer specifications p 165 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 Co
38. 104 Chapter 4 API Reference Print class Constructor Constructor for the Print class Initializes a Print class instance To use the log output function use the Print class Constructor For log output p 106 Syntax public Print Example Print printer new Print Process 105 Print class Constructor For log output Constructor for the Print class Initializes a Print class instance Use this constructor to use the log output function 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 106 Chapter 4 API Reference openPrinter For acquiring printer status This starts communications with the printer and monitoring of printer status x Printer status is notified to the events registered in the print class For details see Automatic Acquisition of Printer Status p 36 If you want to stop monitoring of printer status call closePrinter p 111 A if communication with the printer is not required anymore be sure to call closePrinter p 111 closePrinter API to end communication with the printer When you are opening the printer with another application via a Bluetooth connection if you try to begin communication with this API the process may not return Syntax public void o
39. 111 sendData M2 sendData setStatusChangeEventCallback For acquiring battery status ne me setOnlineEventCallback 118 setOfflineEventCallback 120 setPowerOffEventCallback 122 setCoverOkEveniCallback 124 setCoverOpenEveniCallback 126 setPaperOkEventCallback 128 setPaperNearEndEventCallback 130 setPaperEndEventCallback 182 setBatteryLowEventCallback 138 setBatteryOkEventCallback 140 setBatteryStatusChangeEventCallback 142 EposException Class getErrorStatus 144 getPrinterStatus 145 getBatteryStatus 146 Only for the peeler model All the command transmission reception APIs are supported Q 176 Appendix Battery Status Upper 8 bits Battery Status 0x30 The AC adapter is connected 0x31 The AC adapter is not connected Lower 8 bits 0x30 H level 0x31 M level 0x32 L level 0x33 S level 0x34 Battery not installed 2 If OxO000 is returned the battery status cannot be acquired 177 TM P60Il 58mm 60mm Interface Wi Fi Bluetooth Resolution 203 dpi x 203 dpi W x H Country e North America e Europe 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 Ch
40. 7_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 EposException e int errStatus e getErrorStatus Chapter 4 API Reference addPageBegin Adds the switching to page mode to the command buffer The page mode process starts N Syntax Use this API function with addPageEnd p 84 public void addPageBegin throws EposException Exceptions When processing fail
41. API Reference Example To send a command to the printer by specifying 10 seconds 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 113 sendData For acquiring battery status 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 and AN timeout errors may occur Syntax public void sendData Builder builder int timeout int status int battery throws EposException Parameter e builder Specifies a Builder class instance For details on the Builder class refer to Builder class p 45 e timeout Specifies the transmission reception waiting timeout time 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 Status List p 43 e battery The battery status when command transmission ended is set For details refer to Printer specifications p 165 If an exc
42. 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 108 Chapter 4 API Reference Starts communication with the printer If you want to automatically acquire the printer status use openPrinter For acquiring printer Q status p 107 if communication with the printer is not required anymore be sure to call closePrinter NM p 111 closePrinter API to end communication with the printer When you are opening the printer with another application via a Bluetooth connection if you try to begin communication with this API the process may not return Syntax public void openPrinter int deviceType String deviceName throws EposException Parameter e devicelype Specifies the type for the device to start communication Print DEVTYPE_TCP Wi Fi Ethernet device Print DEVTYPE_BLUETOOTH Bluetooth device e deviceName Specifies the identifier used for identification of the target device Specifies the following for each device type Specified Value Print DEVTYPE_TCP IP address IPv4 Print DEVTYPE_BLUETOOTH MAC address Exceptions When processing fa
43. Code Mode 5 Builder SYMBOL_MAXICODE_MODE_6 Builder SYMBOL_GS1_DATABAR_STACKED MaxiCode Mode 6 GS1 DataBar Stacked Builder SYMBOL_GS1_DATABAR_STACKED_OM NIDIRECTIONAL GS1 DataBar Stacked Omnidirectional Builder SYMBOL_GS1_DATABAR_EXPANDED_ST ACKED GS 1 DataBar Expanded Stacked Builder SYMBOL_AZTECCODE_FULLRANGE Aztec Code Full Range mode Builder SYMBOL_AZTECCODE_COMPACT Aztec Code Compact mode Builder SYMBOL_DATAMATRIX_SQUARE DataMatrix square Builder SYMBOL_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 Chapter 4 API Reference e level Specifies the error correction level Set value Description Builder LEVEL_O PDF417 error correction level O Builder LEVEL_1 PDF417 error correction level 1 Builder LEVEL_2 PDF417 error correction level 2 Builder LEVEL_3 PDF417 error correction level 3 Builder LEVEL_4 PDF417 error correction level 4 Builder LEVEL_5 PDF417 error correction level 5 Builder LEVEL_6 PDF417 error correction level 6 Builder LEVEL_7 PDF417 error correction level 7 Builder LEVEL_8 PDF417 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 corre
44. 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 MO00048904 Rev E Cautions No part of this document may be reproduced stored in a retrieval system or transmitted in any form or by any means electronic mechanical photocopying recording or otherwise without the prior written permission of Seiko Epson Corporation The contents of this document are subject to change without notice Please contact us for the latest information While every precaution has taken in the preparation of this document Seiko Epson Corporation assumes no responsibility for errors or omissions Neither is any liability assumed for damages resulting from the use of the information contained herein Neither Seiko Epson Corporation nor its affiliates shall be liable to the purchaser of this product or third parties for damages losses costs or expenses incurred by the purchaser or third parties as a result of accident misuse or abuse of this product or
45. Exception e timeout Get error value errStatus e getStatus List of Error 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 lllegal 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 158 Chapter 5 Command Transmission Reception Command Transmission Reception API Reference The following classes are available for command transmission reception APIs Epsonlo class Class to transmit and receiv
46. 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 dots x 1200 dots W x H 432 dots x 1200 dots W x H Bar Code 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 175 List of Supported ePOS Print APIs ePOS Print API ePOS Print API Builder Class Constructor 48 Constructor Forlog output 5 clearCommandBuffer 52 addTextAlign 53 adaTextLineSpace 54 addlextRotate 55 addtText 56 addTextLang 57 addlextfont 58 addlextimooth 59 addTextDouble 60 adaTextSize 61 adaTextStyle 62 adaTextPosition 64 addFeedunit 65 addFeedLine 66 adaFeedPosition 101 adalmage For multiple tone printing 67 addlmage 70 addLogo 72 addBarcode 73 addPageBegin 73 addPageEnd 84 addPageArea 84 addPageDirection 87 addPagePosition 87 addPageLine 91 addPageRectangle 91 addCut addlayou 0 addCommand 95 Print Class Constructor 105 Constructor For log output 106 openPrinter a pS acquiring printer status Das Pp tee i closePrinter
47. Listener Paper end notification void onPaperEndEvent String deviceName setPaperEndEventCallback p 132 public interface DrawerClosedEventListener extends EventListener Drawer close notification void onDrawerClosedEvent String deviceName setDrawerClosedEventCallback p 134 Function Chapter 3 Programming Guide Event listener Notification destination method Drawer open notification Notification destination registration API 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 138 Battery OK notification public interface BatteryOkEventListener extends EventListener void onBatteryOkEvent String deviceName setBatteryOkEventCallback p 140 Battery status notification public interface BatteryStatusChangeEventListener extends EventListener void onBatteryStatusChangeEvent String deviceName int battery setBatteryStatusChangeEventCallback p 142 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
48. ND Pattern when there is no paper Builder PATTERN_1 Pattern 1 Builder PATTERN_2 Pattern 2 Builder PATTERN_3 Pattern 3 Builder PATTERN_4 Pattern 4 Builder PATTERN_5 Pattern 5 Builder PATTERN_6 Pattern 6 Builder PATTERN_7 Pattern 7 Builder PATTERN_8 Pattern 8 Builder PATTERN_9 Pattern 9 Builder PATTERN_10 Pattern 10 Builder PARAM_DEFAULT Pattern A e repeat Specifies the number of repeats to 255 Number of repeats Builder PARAM_DEFAULT One time 99 Exceptions When processing fails EposException is thrown with one of the following error values IEC oscrpton ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate 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 100 Chapter 4 API Reference 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 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 Fe
49. NE Battery offline TM P60 TM P6OII 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 UNRECOVER_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 44 23 24 Method API execution error Any of the following will be displayed e Error Code Any of the following statuses will be displayed Shing 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 Print
50. 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 57 58 addTextFont Adds the text font setting to the command buffer Syntax public void addTextFont int font throws EposException Parameter e font Specifies the font Builder FONT_A default Font A Builder FONT_B Font B Builder FONT_C Font C 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 Excep
51. Printer es acquiring printer status en Pp tee i closePrinter 111 sendData 112 setStatusChangeEventCallback 116 setOnlineEventCallback 118 setOfflineEventCallback 120 setPowerOffEventCallback 122 setCoverOkEveniCallback 124 setCoverOpenEventCallback 126 setPaperOkEventCallback 128 setPaperNearEndEventCallback 180 setPaperEndEventCallback 132 setDrawerClosedEventCallback 134 setDrawerOpenEventCallback 136 EposException Class getErrorStatus 144 getPrinterStatus 145 All the command transmission reception APIs are supported NQ 188 Appendix TM T82ll 58mm 80mm Interface Ethernet Resolution 203 dpi x 203 dpi W x H Language e ANK model e Chinese model e Taiwanese 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 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 Bar Code UPC A UPC E EAN13 JAN13 EAN8 JAN8 CODE39 ITF CODABAR CODE93 CODE128 GS1 128 GS1 DataBar Omnid
52. Q OUTPUT irrotus 106 openPrinter For acquiring printer STATUS c ccconccconicicononicononorononarono nono EEEE EEEE EEEE 107 OPNP Sre dean a tate a a od heheh nan a a a a ie atatatena 109 A NA 111 senado arta tada 112 sendData For acquiring battery STOTUS EE E E E rier 114 setsiatusCnangeEventCllbGCk viriiiisciiecahettineaiadeeatanedieaiaisuatlnaiiedametn aa 116 SETONIINEEVENTCOIIDACK Ai A dative weenie 118 SSTOMINEGEVENTE CIIDACK has ects avalado ta iio iaa 120 SetPowerOffEventCallbOCk iia Ai os 122 sete overOkEventEallbUEk siii io di 124 setcoverOpenEventCallb Ek ada 126 setraperOkEventGallbackK aaron is 128 setPaperNearEnGEVenI Callback isis send iio 130 SETPOPEFENGEVENTCONID OC Kiitrsa2 sate TT satus E a a 132 setDrawerClosedEVeniCdllbOCkiiiiaiiccvatdec dics tad 134 selDrawerOpenEventCallba karate iia ro visa 136 setBattervlowEventCallbackK incio io 138 selBatteryOkEVentCEallback inicia is A cal 140 setBatteryStatusCnangeEVentCa lOO Ck oo ee Eee eee nanarann nenas 142 getEMmorta Us a 144 OESIRIINISIOTUS isis radic 145 getBaltsryStatUs asta area dad da dao 146 M Printer Search API sinirinin aaae da 147 STON A aa Aaa EA Aa eaa Imad aE A EA 148 MO EEA T A tien tus E A E T E E AA A TET 149 QER SU ia i iei venia n ini EEE EAT EEN A EAEE A TENE EE aren 150 AO a OS 151 E Log Setting API o o ommxminiciasni rr a ii enesceeneemenneneetenens 152 SOLO GS SHIA e did da Did ips 152 Command Transmission ReceptiON onccccccccccconnncc
53. R_FAILURE An unspecified error occurred 87 88 Example To print the characters ABCDE by rotating them 90 degrees clockwise try Builder builder new builder addPageBegin builder addPageArea 100 50 30 200 builder addPageDirection Builder DIRECTION_TOP_TO_ BOTTOM builder addText ABCDE builder addPageEnd Process catch EposException e Builder TM T88V Builder MODEL_ANK ErrorStatus int errStatus e get 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 2 Use this API function by inserting it between addPageBegin p 83 and addPageEnd p 84 Syntax 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 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
54. 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 Bar Code UPC A UPC E EAN13 JAN13 EAN8 JAN8 CODE339 ITF CODABAR CODE93 CODE128 GS1 128 GS1 DataBar Omnidirectional 6S1 DataBar Truncated GS1 DataBar Limited GS1 Databar Expanded 165 58mm 80mm 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 166 Appendix List of Supported ePOS Print APIs ePOS Print API ePOS Print API Builder Class Constructor 48 Constructor Forlog output 5 clearCommancBuffer 52 addTextAlign 53 adaTextlineSpace 54 addTextRotate 55 addText 56 addTextLang 57 addTextFont 58 addlextSmooth 59 adaTextDouble 60 adaTextsSize 61 addTextStyle 62 adaTextPosition 64 addFeedunit 65 addFeedLine 66 addalmage For multiple tone printing 67 adalmage 70 addLogo 72 addBarcode 73 addSymbol 78 addPageBegin 83 addPageEnd 84 addPageArea 85 addPageDirection 87 addPagePosition 89 addCut 95 adaPulse 96 addSounal For setting cycle buzz
55. XPANDED Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED Process catch EposException e int errStatus e getErrorStatus 77 78 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 0to9 AtoZ space 4 Kanji character Shift JIS value 8 bit byte data Ox00 to Oxff Chapter 4 API Reference 2D Code ype MaxiCode Mode 2 Convert the character string to the string in UTF MaxiCode Mode 3 8 apply the escape sequence and then MaxiCode Mode 4 encode the string MaxiCode Mode 5 In Modes 2 and 3 when the first piece of data is 0 gt x1e01 xldyy where yy is a two digit num ber this is processed as the message h
56. a gt printer openPrinter Print DEVTYPE_TCP 192 168 192 168 printer sendData builder 10000 status battery e getErrorStatus status 0 e getPrinterStatus e getBatteryStatus 40 Chapter 3 Programming Guide Search API Acquire the error status using getStatus p 151 of the EpsonloException class Use the programming example below for your reference int errStatus IoStatus SUCCESS String mList null Acquire a list of devices try Finder start getBaseContext DevType TCP 255 255 255 255 mList Finder getResult Exception processing catch EpsonloException e errStatus e getStatus 41 Error Status List Error statuses are defined in each APl executing class IEC Cause Invalid parameter was passed lt Example gt A e An invalid parameter such as null was passed e A value outside the supported range was specified Open processing failed ERR_OPEN lt Example gt Could not connect to the designated printer Failed to connect to device ERR_CONNECT lt Example gt Failed to send the data to the printer The specified timeout time was exceeded ERR_TIMEOUT lt Example gt Could not transmit all the data in the specified time ERR_MEMORY Could not allocate the necessary memory for processing Illegal method used lt Example gt When the printer was not opened an API for sending a command to the printer wa
57. aa EMARE TEATA LETAT 48 Builder class Constructor For log OUTOUD mnmmiiocicccocaninin nono noron caro no nora nor r rr rrnrrrrrnr rr rrn REENEN 50 GISSICOMMOGNGABUMSM waite Gave siiastapeetersacetuuesndscvdieas is snus Oca cda qe data IA O e a at salle OObiaaeane 52 IOMA MONO A RA OE Ne Oh Gite A IN A RATA 53 OAGTEXTLINGS OCG Csi casas aio Ia laatvacaesaafendtav ols E Ra EA Ea 54 Olole ENNO e ri A ane wie tein es A A aia 55 VAG MES ste A a NINE A ANA 56 adagio id A BURA ah ee ena pe ate a di 57 ICC SYA OM ieee E E E E A A E ssanesaewansiaieawaptesadea aes 58 AAAMOOO E T A octal 59 dada lSxiDOUbDIS ta E E E AT 60 Ad St AA a a a A A E T O l SU AA A E E E E a anstneaaaaaaeans 62 GACTSXTPOSITION urene e AN A RA AAE N Eaa 64 GAAF SAURI rnea O O AA 65 oo O A A 66 adadalmage For multiple tone Printing 0mniinninnnnicnnnicioncccnnaranncarro nora rr rr rr 67 GdCIMaGS ci a a tt aural auras 70 olele Kole OAE A E NON 72 Olo lol 1e 0o E ii E A ae AAG AA T 73 ele o Rgp A EE EEE EE TE A E E E 78 GACRAGSBECIN sics n i a A nile EN TA E ENE 83 ao Ret aa O O aa a i 84 o E O O 85 addPageDirectior arei Aktar a o cia 87 addrRagePOSM ON e a a A AAA 89 GQUOPAGERECTONGIC inanem AS hay 93 adadCUtasiiasanantrins ao abia 95 A E a OO 96 addSound For setting cycle BUZZ iaa aaa debate 97 olele UNO aaa 99 adds ad MON mirta dee 101 adala yola 102 GAdAICOMMONG cria dai ra a a 104 Printclass CONSTITUCION ar A E A A AS 105 Print elass Constructor FOr lO
58. adaTextStyle 62 adaTextPosition 64 addFeedunit 65 addFeedLine 66 addalmage For multiple tone printing 67 adalmage 70 addLogo 72 addBarcode 73 addSymbol 78 addPageBegin 83 addPageEnd 84 addPageArea 85 addPageDirection 87 addPagePosition 89 addCut 95 adaPulse 96 ICAA A fT Print Class Constructor 105 Constructor Forlogoutput T 106 openPrinter es acquiring printer status lor Sepia a closePrinter 111 sendData 112 setStatusChangeEventCallback 116 setOnlineEventCallback 118 setOfflineEventCallback 120 setPowerOffEventCallback 122 setCoverOkEventCallback 124 setCoverOpenEventCallback 126 setPaperOkEventCallback 128 setPaperNearEndEventCallback 180 setPaperEndEventCallback 132 setDrawerClosedEventCallback 134 setDrawerOpenEventCalloack 136 EposException Class getErrorStatus 144 getPrinterStatus 145 All the command transmission reception APIs are supported Q 174 Appendix TM P60 58mm 60mm 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
59. address of the device that is notified of cover open event is set Chapter 4 API Reference 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 TRU Print PARAM DEFAULT Process catch EposException e int errStatus e getErrorStatus OG 127 128 setPaperOkEventCallback This registers the notification destination of paper OK events This refers to events that are notified when printer status indicates paper OK p 107 When this API is executed on multiple occasions the notification destination that is specified afterwards is overwritten 2 e This API can be executed following execution of openPrinter For acquiring printer status 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 soecified for either the method or target the noti fication destination registration is nullified Listener Interface public interface PaperOkEventListener extends EventListener Listener Reg
60. age Barcode 2D Code Page Mode Cut Get Status Get Printer Name Log Settings The Sample Program has the following functionality 1 Searching for printers d Opening of port 1 Closing of port 1 Text printing T Graphic printing image file printing Barcode printing 2D code printing Printing in page mode Paper cutting a a a a A Printer status acquisition q Acquisition of printer model name language information 1 Log output setting A Display of status event a Display of battery status event 2 The sample program does not contain a functionality for turning text images barcodes etc 15 Usage Environment 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 Q 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 16 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 Select root director
61. ame Process private void openPrinter Print printer new Print printer setPowerOffEventCallback this try printer openPrinter Print DEVTYPE_TCP 192 168 192 168 Print TRU Print PARAM_DEFAULT Process catch EposException e int errStatus e getErrorStatus OG 123 124 setCoverOkEventCallback This registers the notification destination of cover close events This refers to events that are notified when printer status indicates cover close p 107 When this API is executed on multiple occasions the notification destination that is specified afterwards is overwritten 2 e This API can be executed following execution of openPrinter For acquiring printer status 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 soecified 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 MAC address of the device that is notified of cover ok event is set Chapter 4 API Reference Example public class SampleActivity e
62. and monitoring of 107 For acquiring printer status the printer status openPrinter Start communication with the printer 109 closePrinter End communication with the printer 111 sendData Sends a command to the printer me O battery status Sends a command to the printer 114 setStatusChangeEventCallback Registers the printer status notification destination 116 setOnlineEventCallback Registers the online event notification destination 118 setOfflineEventCallback Registers the offline event notification destination 120 setPowerOffEventCallback Registers the power off event notification destination 122 setCoverOkEventCallback Registers the cover close event notification destination 124 setCoverOpenEventCallback Registers the cover open event notification destination 126 setPaperOkEventCallback Registers the paper OK event notification destination 128 setPaperNearEndEventCallback oe the paper near end event notification destina 130 setPaperEndEventCallback Registers the paper end event notification destination 132 setDrawerClosedEventCallback Registers the drawer close event notification destination 134 setDrawerOpenEventCallback Registers the drawer open event notification destination 136 setBatteryLowEventCallback Registers the battery low event notification destination 138 setBatteryOkEventCallback Registers the battery OK event notification destination 140 A Registers the battery status notification destination 142 EposException class
63. aracter 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 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 Bar Code 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 G 1 DataBar Stacked 6S1 DataBar Stacked Omnidirectional GS1 DataBar Expanded Stacked Composite Symbology Paper Cut Cut Feed cut Drawer Kick Out Not supported Buzzer Optional Battery Supported 178 List of Supported ePOS Print APIs Appendix ePOS Print API ePOS Print API Builder Class Constructor 48 Constructor For log output 50 clearCommandBuffer 52 addTextAlign 53 addTextLineSpace 54 adaTextRotate 55 addText 56 addTextLang 57 addTextFont 58 addTextSmooth 59 addTextDouble 60 adaTextsSize 61 addTextStyle 62 adaTextPosition 64 addFeedunit 65 addFeedLine 66 addFeecPosition 101 addlimage For multiple tone printing 67 addlmage 70 addLogo 2 addBarcode J3 addSymbol 78 addPageBegin 83 addPageEnd 84 addPageAr
64. arameter e reverse e color 62 throws EposException Specifies inversion of black and white for text Set value Builder TRUE Description 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 Specifies the underline style Set value Builder TRUE Specifies underlining Builder FALSE default Builder PARAM_UNSPECIFIED Cancels underlining Retains the current setting 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 Specifies the color Set value Builder COLOR_NONE Builder COLOR_1 default Characters are not printed First color Builder COLOR_2 Builder COLOR_3 Second color Third color Builder COLOR_4 Fourth color Builder PARAM_UNSPECIFIED Retains the current color setting Chapter 4 API Reference Exceptions When processing fails EposException is thrown with one of the following error values MESA AA ed ERR_PARAM Invalid parameter was passed ERR_MEMORY Could not allocate memory ERR_FAILURE An unspecified error occurred Example To set
65. arcode printing Execute the barcode printing according to the following procedure A Set the following for barcodes 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 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 Set the error correction level Code DataMatrix 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 1 Enter a string to print for Print Characters 2 Set the print area using Print Area 3 Description Xx 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 Tap Print to print Paper cutting Execute the paper cutting according to the following procedure 1 2 Set whether to cut after feeding paper using Type Tap Print and execute cutting operation Log output settin
66. ax 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 CENTER Process catch EposException e int errStatus e getErrorStatus 53 54 addTextLineSpace Adas 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 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
67. click Ok A A Double click AndroidManifest xml from Eclipse s Package Explorer A 2 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 A 5 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 android permission BLUETOOTH_ADMIN Bluetooth Permission in Permissions For using the Bluetooth functionality and all functionalities There is one setting of permissions for functionalities that can be attached per Uses Q 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
68. cnnnccconincnnns 155 DPTO kolana aTe EAA iia ini 155 Programming O Wisin a o aos 155 Opening A DeviGS POM mei nies esas aie Gaited Mend wae Soa aaa 156 sending Data Bid Wea wae I a e alanine ladadvetihens 156 RECEIVING DM A oa 157 Closing the DEVICE Poda rs dia 157 Exception Nal Ti A dais E Command Transmission Reception API Reference ooocoonnccccccncooocccccccononnnnnncnnnnannnnnnos Chapter 1 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 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 OS 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 APIs refer to Command Transmission Reception p 155 2 APIs for transmitting receiving commands to from TM printers are also provided 1 Allows printing to TM printers from Android applications 1 Allows acquisition of TM printer status from Android applications 10 ePOS Print API LE CO Cc O Print setting alignment line feed space text rotation page mode Character data setting language font device font double
69. ction level Q Builder LEVEL_H QR Code error correction level H Builder LEVEL_DEFAULT Default level 5t095integer Aztec Code error correction level percent unit Builder PARAM_UNSPECIFIED Retains the current setting Select the level according to the 2D Code type NH For MaxiCode two dimensional GS1 DataBar DataMatrix select Builder LEVEL_DEFAULT e width Specifies the module width Integer from 0 to 255 Module width Builder PARAM_UNSPECIFIED Retains the current setting MaxiCode is ignored A e height Specifies the module height Set value Description Integer from 0 to 255 Module height Builder PARAM_UNSPECIFIED Retains the current setting QR Code MaxiCode two dimensional GS1 DataBar Aztec Code DataMatrix are ignored A 81 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 EposException is thrown with one of the following error values Jeon stots se 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_PDF41
70. d 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 49 50 Builder class Constructor For log output Constructor for the Builder class Initializes a Builder class instance Use this constructor to use the log output function Syntax public Parameter e printerModel e lang e context Builder String printerModel int lang Context context throws EposException 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 P60 TM P60 TM P 60II TM P60ll TM T20 TM T20 TM T8 111 TM T8111 TM T82 TM T82 TM T82II TM T821l TM T9OI TM T9OIl Specifies the language specifications for the printer Set value Builder MODEL_ANK ANK model Builder MODEL_JAPANESE Japanese model Builder MODEL_CHINESE Chinese model Builder MODEL_TAIWAN Taiwanese model Builder MODEL_KOREAN Korean model Builder MODEL_THAI Thai model Builder MODEL_SOUTHASIA South Asian m
71. der LINE_THIN Chapter 4 API Reference addPageRectangle Adds rectangle drawing in page mode to the command buffer Draws a rectangle in page mode Q Syntax Use this API function by inserting it between addPageBegin p 83 and addPageEnd p 84 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 Spec Spec fies the vertical start position of the line in dots ifies an integer from O to 65535 e x2 Spec Spec fies the horizontal end position of the line in dots ifies an integer from O to 65535 e y2 Spec Spec fies the vertical end position of the line in dots ifies an integer from O to 65535 e style Specifies the line type Builder LINE_THIN Solid line Thin Builder LINE MEDIUM Solidline Medium gt O 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
72. droid application for TM printers developed using ePOS Print SDK for Android the following program is available m ePOS Print_Sample_Anaroid zip Download For customers in North America go to the following web site htto www epsonexpert com For customers in other countries go to the following web site https download epson biz com service pos Restrictions 14 a A communication API p 47 and command transmission reception API p 155 in the ePOS Print APIs cannot be used for the same device at the same time A maximum of 16 device ports can be opened in the same application at the same time More than one port cannot be opened for the same device 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 If the device goes into sleep mode while communicating with a printer via Bluetooth the connection will be lost Chapter 2 Sample Program sample Program This chapter describes how to use the sample program ePOS Print Sample Program for Android including the Java source files For an Android application for TM printers developed using ePOS Print SDK the following program is available 2 The sample program is provided as an Android application project for use with Eclipse Functionality ePOS Print Printer Discovery Open Close Text Im
73. e data The following APIs are available open Opens the device port 159 close Closes the device port 161 write Send data 162 read Receive data 164 Opens the specified device port 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 Devlype 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 DevType TCP IP address IPv4 DevType BLUETOOTH MAC address e deviceSettings Specify null 159 Exceptions When processing fails EpsonloException is thrown 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 160 Chapter 5 Command Transmission Reception Closes the specified device port Syntax public void close throw
74. e 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 If the amount of time specified in timeout is exceeded the returned return value is the number of Q bytes that were sent up to that point 162 Chapter 5 Command Transmission Reception 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 Couldnotallocatememory loStatus ERR_FAILURE An unspecified error occurred 163 Receives data from a device port This API continues receiving until a receiving error occurs However if not even a single byte of NM data is received during the period specified 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
75. e 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 PaperEndEventListener extends EventListener Listener Registration Method void onPaperEndEvent String deviceName Parameter e deviceName The identifier IPv4 type IP address MAC address of the device that is notified of paper end event is set Chapter 4 API Reference 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 TRU Print PARAM DEFAULT Process catch EposException e int errStatus e getErrorStatus OG 133 134 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 p 107 When this API is executed on multiple occasions the notification destination that is specified afterwards is overwritten 2 e This API can be executed following execution of openPrinter For acqu
76. ea 85 addPageDirection 87 addPagePosition 89 addCut 95 addSound For setting cycle buzzer 97 addSound 99 addLayout 102 addCommand 104 Print Class Constructor 105 Constructor For log output 106 openPrinter ne acquiring printer status yay Sesa i closePrinter Wy sendData 114 sendData setStatusChangeEventCallback For acquiring battery status Ho dde setOnlineEventCallback 118 setOfflineEventCallback 122 setPowerOffEventCallback 122 setCoverOkEventCallback 126 setCoverOpenEveniCallback 126 setPaperOkEventCallback 130 setPaperNearEndEventCallback 130 setPaperEndEventCallback 138 setBatteryLowEventCallback 138 setBatteryOkEventCallback 142 setBatteryStatusChangeEventCallback 142 EposException Class getErrorstatus 144 getPrinterStatus 145 getBatteryStatus 146 Only for the peeler model N All the command transmission reception APIs are supported 179 Battery Status Upper 8 bits Battery Status 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 0x35 Battery amount 5 0x36 Battery amount 6 Q If Ox0000 is returned the battery status cannot be acquired 180 Appendix TM U220 1 DIpSW2 1 ON 76mm 69 5mm 57 5mm
77. eader 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 MaxiCode Mode 6 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 Convert the character string to the string in UTF 8 apply the escape sequence and then encode the string GS1 DataBar Stacked Omnidirectional Specify a 13 digit global trade item number GTIN not including an application identifier AB or a check digit 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 as HRI print characters and are not encoded as data Gol DaicBer Sxeielaeicie aie lt I To encode each of the following characters specify two characters starting with the character FNC1 0 After converting the character string to UTF 8 conduct the escape sequence and encode Aztec Code Full Range mode Up to 3 067 characters
78. ed when the application is ended Th ti f this API Log LOG_ PERMANENT e se inge ie are enabled even after the application is ended To specify period for the Log LOG_PERMANENT set the permissions for the application NM to access the storage 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 NM to access the storage To specify enabled for the Log LOG_TCP set the permissions for the application to access the network e pAdaress Specifies the IPv4 IP address for TCP communication If either of the following values is specified for period null can be specified for this NH 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 period specify an integer within the NH 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 period specif
79. eds 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 101 102 addLayout Adds label black mark paper layout information to the command buffer Syntax public void addLayout int type int width int height Parameter type width height marginTop marginBottom offsetCut offsetLabel Exceptions int marginTop int marginBottom int offsetCut int offsetLabel throws EposException Specifies the paper type Set value Description 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 Specifies paper width in units of 0 1mm Specifies an integer from 1 to 10000 Specifies the distance in units of 0 1mm from the standard printing position to the next standard printing position Specifies an integer from O to 10000 If O
80. eption occurs use getPrinterStatus p 145 with exception handling to acquire the 3 printer status and getBatteryStatus p 146 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 114 Chapter 4 API Reference Example To send a command to the 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 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 115 116 setStatusChangeEventCallback This registers the notification destination of printer status p 107 When this API is exec
81. er 97 addSound Q addCommand 104 Print Class Constructor 105 Constructor For log output 106 openPrinter es acquiring printer status en Pp tee i closePrinter 111 sendData 112 setStatusChangeEventCallback 116 setOnlineEventCallback 118 setOfflineEventCallback 120 setPowerOffEventCallback 122 setCoverOkEveniCallback 124 setCoverOpenEventCallback 126 setPaperOkEventCallback 128 setPaperNearEndEventCallback 180 setPaperEndEventCallback 182 setDrawerClosedEventCallback 134 setDrawerOpenEventCallback 136 EposException Class getErrorStatus 144 getPrinterStatus 145 All the command transmission reception APIs are supported NQ 167 TM T70 80mm Interface Ethernet Wi Fi Resolution 180 dpi x 180 dpi W x H Language e ANK model e Japanese model e Chinese model e Taiwanese 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 chara 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 Bar Code UPC A UPC E EAN13 JAN13 EAN8 JAN8 CODE39 ITF CODABAR CODE93 CODE128 Two Dimensional Code
82. er 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 2 A command transmission reception API is used for acquisition of printer model name For details refer to Command Transmission Reception p 155 Use the following 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 When Device Type is selected the printers detected by the search are displayed in list form Select the printer to use among the printers displayed in list form in procedure 2 Tap Get Printer Name on the main screen Tap Get Printer Name 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 og hh W 25 26 Chapter 3 Programming Guide Programming Guide This chapter describes how to write programs in the application development using ePOS Print SDK SDK for Android please refer to the ePOS Print SDK for Android Application Development For ways to construct a development environment for Android applications that use ePOS Print Q Setup Guide How to Incorporate the ePOS Print SDK for Android This section explains how to incorporate
83. f a battery low event This refers to events that are notified when printer status is battery offline p 107 When this API is executed on multiple occasions the notification destination that is specified afterwards is overwritten 2 e This API can be executed following execution of openPrinter For acquiring printer status 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 soecified 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 MAC address of the device that performed battery low event notification is set Chapter 4 API Reference 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 TRU Print PARAM DEFAULT Process catch EposException e
84. g Use the following procedures 1 2 A Q Set whether to enable the log output function and the log output destination in Enabled 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 spect the maximum size of log data that can be saved on the device s storage Log Level Set the level of log data to be output Set the method of saving the settings in Save Settings Permanently Tap Setting to enable the log output settings 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 P 0I BATTERY_OFFLI
85. g the Builder class If you are using a Bluetooth connection it may not be able to detect the offline status and NM timeout errors may occur If you want to acquire the battery status when sending a print document use sendData For Q acquiring battery status p 114 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 45 e timeout Specifies the transmission reception waiting timeout time 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 Status List p 43 In an exception occurs use the getPrinterStatus p 145 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 112 Chapter 4
86. gin 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 33 Transmission of Print Document Send a print document using the Print class p 47 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 Use the programming example below for your reference catch EposException e Initialize a Print class instance Print printer new Print int status new int 1 status 0 0 try age p 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 addTextSmooth Builder TRUE builder addTextFont Builder FONT_A builder addTextSize 4 4 builder addTex
87. h digit is pro cessed as a check digit but the check digit is not validated EAN8 Whena 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 CODE93 Start and stop characters are automatically added A check digit is automatically calculated and added 73 Barcode type 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 FNC3 B FNC4 4 CODE A A CODE B B CODE C C SHIFT S A start character 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
88. idth and height try Builder builder new Builder TM T88V Builder MODEL_ANK builder addTextDouble Builder TRUE Builder TRUE Process catch EposException e int errStatus e getErrorStatus 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 A Nar 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 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 61 addTextStyle Adds the text style setting to the command buffer Syntax public void addTextStyle int reverse int ul int em int color P
89. ils EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_OPEN Open processing failed 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 109 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 110 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 111 Sends a print document created usin
90. information using the EposException class p 47 and the search API acquires information using the EposException class p 47 The following errors are sent Error status Cause of error when each class s API was executed For details refer to Error Status List p 42 Printer status Status of the printer when print data was sent The printer status can be acquired only when sendData p 112 is executed For details refer to Printer Status List 0 43 Battery status Status of the printer s battery For details refer to Battery Status p 44 Steps for Handling ePOS Print API Acquire the error status using the EposException class getErrorStatus p 144 the printer status using getPrinterStatus p 145 and the battery status using getBatteryStatus p 146 Use the programming example below for your reference lt Send data for confirmation gt Print printer new Print new int 1 new int 1 int status int battery status 0 0 battery 0 0 try Create a print document builder addText Hello t builder addText World n printer closePrinter catch EposException e Acquire the error status int errStatus Acquire the printer status Acquire the battery status battery 0 printer closePrinter Builder builder new Builder TM T88V t Builder MODEL_ANK builder addCut Builder CUT_FEED lt Send print dat
91. int errStatus e getErrorStatus Chapter 4 API Reference addTextRotate Adas the text rotation setting to the command buffer 2 This API setting also applies to barcodes two dimensional symbols When the page mode is selected for the print mode to set text rotation use the addPageDirection NM p 87 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 Cancels 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 55 56 addText Adds the printing of text to the command buffer A After printing text to print content other than text execute line feed or paper feed Syntax public void addText String data throws EposException Parameter e data Specify a character string to be printed For the horizontal tab
92. ion Parameter e xl Specifies the horizontal start position of the line in dots Specifies an integer from O to 65535 e yl Spec Spec fies the vertical start position of the line in dots ifies 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 Spec Spec fies the vertical end position of the line in dots ifies an integer from O to 65535 e style Specifies the line type Set value Description 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 91 Example To draw a thin solid line between the start position 100 0 and the end position 500 0 92 try Builder builder new Builder TM P60 Builder MODEL_ANK builder addPageBegin builder addPageLine 100 0 500 0 builder addPageEnd Process catch EposException e int errStatus e getErrorStatus Buil
93. irectional 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 List of Supported ePOS Print APIs ePOS Print API ePOS Print API Builder Class Constructor 48 Constructor Forlog output 52 clearCommancBuffer 52 addTextAlign 53 addTextlineSpace 54 addTextRotate 55 addText 56 addTextLang 57 addTextFont 58 addlextSmooth 59 adaTextDouble 60 adaTextsSize 61 adaTextStyle 62 adaTextPosition 64 addFeedunit 65 addFeedLine 66 addalmage For multiple tone printing 67 adalmage 70 addLogo 72 addBarcode 73 addSymbol 78 addPageBegin 83 addPageEnd 84 addPageArea 85 addPageDirection 87 addPagePosition 89 addCut 95 adaPulse 96 addSounal For setting cycle buzzer 97 addSound Q addCommand 104 Print Class Constructor 105 Constructor For log output 106 openPrinter es acquiring printer status en Pp tee i closePrinter 111 sendData 112 setStatusChangeEventCallback 116 setOnlineEventCallback 118 setOfflineEventCallback 120 setPowerOffEventCallback 122 setCoverOkEveniCallback 124 setCoverOpenEventCallback 126 setPaperOkEven
94. iring printer status 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 soecified 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 MAC address of the device that is notified of drawer closed event is set Chapter 4 API Reference 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 TRU Print PARAM DEFAULT Process catch EposException e int errStatus e getErrorStatus OG 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 p 107 When this API is executed on multi
95. is valued around the world Copyright 2012 2013 Seiko Epson Corporation All rights reserved For Safety AO OS 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 necessary for the construction and design of a printing system that uses ePOS Print SDK and for the development and design of printer app
96. istration Method void onPaperOkEvent String deviceName Parameter e deviceName The identifier IPv4 type IP address MAC address of the device that is notified of paper ok event is set Chapter 4 API Reference 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 129 130 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 p 107 When this API is executed on multiple occasions the notification destination that is specified afterwards is overwritten 2 e This API can be executed following execution of openPrinter For acquiring printer status 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 soecified for either the method or target the no
97. ked Omnidirectional GS1 DataBar Expanded Stacked Composite Symbology Paper Cut Cut Feed cut Drawer Kick Out Supported Buzzer Not supported Battery Not supported 183 List of Supported ePOS Print APIs ePOS Print API ePOS Print API Builder Class Constructor 48 Constructor Forlogoutput 5 clearCommancBuffer 52 addTextAlign 53 adaTextlineSpace 54 addTextRotate 55 addText 56 addTextLang 57 adaTextFont 58 addText mooth 59 adaTextDouble 60 adaTextsSize 61 adaTextStyle 62 adaTextPosition 64 addFeedunit 65 addFeedLine 66 addalmage For multiple tone printing 67 adalmage 70 addLogo 72 addBarcode 73 addSymbol 78 addPageBegin 83 addPageEnd 84 addPageArea 85 addPageDirection 87 addPagePosition 89 addCut 95 adaPulse 96 ICAA A fT Print Class Constructor 105 Constructor Forlogoutput T 106 openPrinter es acquiring printer status lor Sepia a closePrinter 111 sendData 112 setStatusChangeEventCallback 116 setOnlineEventCallback 118 setOfflineEventCallback 120 setPowerOffEventCallback 122 setCoverOkEventCallback 124 setCoverOpenEventCallback 126 setPaperOkEventCallback 128 setPaperNearEndEventCallback 180 setPaperEndEventCallback 132 setDrawerClosedEventCallback 134 setDrawerOpenEventCalloack 136 EposException Class getErrorStatus 144 getPrinterStatus 145 All
98. lder 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_6GS1_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 Builder HRI_NONE default HRI not printed Builder HRI_ABOVE Above the bar code Builder HRI_BELOW Below the bar code Builder HRI_BOTH Both above and below the bar code Builder PARAM_UNSPECIFIED Retains the current setting 75 e font Specifies the HRI font Builder FONT_A default Font A Builder FONT_B Font B Builder FONT_C Font C 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 Description Integer from 1 to 6 The width of each module Unit dot Builder PARAM_UNSPECIFIED Retains the current setting e height Specifies the barcode height 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
99. lications Manual Content The manual is made up of the following sections Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Appendix Overview Sample Program Programming Guide API Reference Command Transmission Reception Printer specifications Contents o ETE E ie en A a A E E E AN AR 3 Key to SYMONS iar eatin A A A al ds 3 E Restriction Of USE iii dades 3 Bl ADOout this MANUAL asii 4 Alm of the ManuGlasintesits Aaa tae ania aaa nes el ee a eh 4 MONG SANA A A TAE teach tant 4 Bl CONMCINS iii iia 5 OVOIVMIOW canicas ir idad 9 MN Overview of 6POS Print SDK ova ini ica de 9 A O NN 9 AS NN O dees hel 10 E Operating Environ Met ccoocccccccnnncccnnnnnccnnnncnnnnanoncnnnnnnnnnn nen c conan n nan crac cnn rre rre annnrnnnnaes 11 Android Verid ei et eine aide tae ak 11 Android DeCS ui a aa Oi 11 Pintos a aa iS 11 Development ENVIO MN Erin A R AAA 12 E Contents in the Package E AT 13 Packager id ai 13 Manuala enna a A ea aaa oe 13 Sample PODA Mii dada 13 DOWNA nica EA OEA li DORA AS 13 ME RESHICTIONS A AA A AA A AA AA a A 14 Sample Program asta tdo 15 BB FUR CHO a eh eas iia lacada 15 ME Usage ENVITONMONT iii ic cada 16 Development ENVIFONMENT occ ccccccccccccccetsecceeceeeecceeeseeeeceeeeeeeessceeeeeesceeeeeeessceeeeeeeeseesuaeeseceesaseesesenaaees 16 Pt A E ear Gn ano iad oat aaa nbn 16 NAKG STHOSVICS arado don rta abanahtonts A Bla cl Oral caia rasa tyre te 16 E Environmental Construction
100. line feed use the following escape sequences ein ft 1 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 builder addText Hello t builder addText World n catch EposException e 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 adaText p 56 according to the language information specified by this API N Syntax This API is an API to be called before calling addText p 56 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 Simple 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_
101. lowing execution results will be displayed e Process execution result error status printer status battery status For details refer to Process execution result p 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 for 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 model Q 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 Chapter 2 Sample Program B
102. 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 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 71 72 To o oTe o Adds NV logo printing to the command buffer Prints a logo registered in the NV memory of the printer Register a logo in advance into the printer using the following utilities Q Model dedicated Utility e TM Flash Logo Setup Utility Syntax public void addLogo int keyl int key2 throws EposException Parameter e key Specifies the key code 1 of an NV logo Specifies 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
103. ns with the printer and monitoring of the printer status printer openPrinter Print DEVTYPE_TCP 192 168 192 168 Print TRUE Print PARAM DEFAULT Process catch EposException e int errStatus e getErrorStatus printer closePrinter A Define the listener interface for acquiring the printer status Q specified in openPrinter For acquiring printer status p 107 is defined ePOS Print 2 Implement the notification destination method when events occur 3 Register the printer status notification destination Above StatusChangeEventListener which notifies printer status at the intervals 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 38 for the listener interface that can be used with Chapter 3 Programming Guide 4 Use openPrinter For acquiring printer status p 107 to start monitoring of the printer status 5 Notify the printer status to the event implemented in 2 N When printer status notification is ended it ends on the closePrinter p 111 of the Print class 37 Listener Interface List For details on the listener interface refer to API Reference p 45 which explains the Q notification destination registration API Event listener Function Notification destina
104. nstructor Initialize a Builder class instance 48 Initialize a Builder class instance Constructor For log output i 50 This constructor is for the log output function Clearing clearCommandBuffer Clears the command buffers added by APIs 52 command buffers addTextAlign Adds a tag for the text alignment setting 53 adaTextLineSpace Adds a tag for the line feed space setting 54 addTextRotate Adds a tag for the text rotation setting 55 addText Adds a tag for printing text 56 addTextLang Adds a tag for the target language setting 97 addTextFont Adds a tag for the text font setting 58 Text addTextSmooth Adds a tag for the text smoothing setting 59 d TetD bl Agos a tag for specifying the double sized text 60 setting addtTextSize Adds a tag for the text scale setting 61 adaTextStyle Adas a tag for the text style setting 62 addTextPosition Adds a tag for specifying the print position of 64 text addFeedUnit Adds a tag for paper feeding in dots 65 paper Fse addFeedLine Adds a tag for paper feeding in lines 66 addPaperFeedPosi Adds a tag for label black mark paper feed 101 tion ing 45 46 API addlmage Adds multiple tone raster image printing to the F a eS fone command buffer or Graphic printing addimage Adds a tag for a raster image to be printed 70 addLogo Adds a tag for an NV logo to be printed 72 B d addBarcode Adds a tag fo
105. nter openPrinter Print DEVTYPE_TCP 192 168 192 168 Print TRUE Print PARAM_DEFAULT Process catch EposException e int errStatus e getErrorStatus 121 122 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 p 107 When this API is executed on multiple occasions the notification destination that is specified afterwards is overwritten 2 This API can be executed following execution of openPrinter For acquiring printer status 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 MAC address of the device that is notified of power off event is set Chapter 4 API Reference Example public class SampleActivity extends Activity implements OnClickListener PowerOffEventListener Process private void onPowerOffEvent String deviceN
106. odel Specifies the context of the application 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 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 51 52 clearCommandBuffer Clears command buffers used by APIs of the Builder class Syntax public void clearCommandBuffer 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 When the page mode is selected for the print mode use addPagePosition p 89 instead of this NM API to set the alignment This API setting also applies to barcodes 2D Code Synt
107. of text 3 832 numerical figures and 1 914 bytes of binary data can be specified 79 e type 2D Code type 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 DataMatrix square DataMatrix rectangle 8 lines DataMatrix rectangle 12 lines DataMatrix rectangle 16 lines After converting the character string to UTF 8 conduct the escape sequence and encode 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 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 SN A E xnn Control code Back slash Specifies the 2D Code type Set value Builder SYMBOL_PDF417_STANDARD Builder SYMBOL_PDF417_TRUNCATED 2D Code type Standard PDF417 Truncated PDF417 Builder SYMBOL_QRCODE_MODEL_1 Builder SYMBOL_QRCODE_MODEL_2 QR Code Model 1 QR Code Model 2 Builder SYMBOL_MAXICODE_MODE_2 Builder SYMBOL_MAXICODE_MODE_3 MaxiCode Mode 2 MaxiCode Mode 3 Builder SYMBOL_MAXICODE_MODE_4 Builder SYMBOL_MAXICODE_MODE_5 MaxiCode Mode 4 Maxi
108. onIoException e errStatus e getStatus if you call the Finder class s getResult immediately after you call start 2 Since the printer search takes time to complete you might not receive any search results Stopping the printer search Use the Finder class s stop p 149 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 Chapter 3 Programming Guide Print Document Creation Create a print document using the Builder class p 45 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
109. 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_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 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 151 Log Setting API 152 Sets the log output The following class is available m Log class p 152 Log class Sets the log output function setLogSettings Sets the log output function 182 setLogSettings Sets the log output function Syntax public static void setLogSettings Context context int period int enabled String ipAddress int port int logSize int logLevel throws EposException Parameter e context Specifies the context of the application e period Specifies the method of setting the log output function Description Log LOG_TEMPORARY The settings at this API are disabl
110. 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 Chapter 4 API Reference 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 iype When an 11 digit number is specified a check digit is auto matically added UPC A 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 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 12t
111. penPrinter int deviceType String deviceName int enabled int interval throws EposException Parameter e devicelype Specifies the type for the device to start communication Print DEVTYPE_TCP Wi Fi Ethernet device Print DEVTYPE_BLUETOOTH Bluetooth device e deviceName Specifies the identifier used for identification of the target device e enabled e interval Specifies the following for each device type Specified Value 4 Print DEVTYPE_TCP IP address IPv4 Print DEVTYPE_BLUETOOTH MAC address 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 This specifies the interval in units of milliseconds for updating printer status Specified Value 1000 to 60000 integer A for updating printer status in units of millisec Print PARAM_DEFAULT Specify the default value 1000 107 Exceptions When processing fails EposException is thrown with one of the following error values ERR_PARAM Invalid parameter was passed ERR_OPEN Open processing failed ERRILLEGAL 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
112. ple occasions the notification destination that is specified afterwards is overwritten 2 This API can be executed following execution of openPrinter For acquiring printer status 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 soecified 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 MAC address of the device that is notified of drawer open event is set Chapter 4 API Reference 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 TRU Print PARAM DEFAULT Process catch EposException e int errStatus e getErrorStatus OG 137 138 setBatteryLowEventCallback This registers the notification destination o
113. 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 3 e Scale x 4 horizontal and x 4 vertical e Style Bold try OA 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 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 31 32 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 70 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 try 4 Initialize a Builder class instance Builder builder new Builder TM T88V Builder MODEL_ANK Create a print document Bitmap bmp BitmapFactory decodeResource getResources R d
114. printer If transparent shading is included it is regarded as white To print a raster image at high speed specify Builder ALIGN_LEFT for the addTextAlign p 53 Q and specify 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 Syntax public void addImage Bitmap data int x int y 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 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 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 Set value Description Builder COLOR_NONE Characters are not printed Builder COLOR_1 First color Builder COLOR_2 Second color Builder COLOR_3 Third color Builder COLOR_4 Fourth color Builder PARAM_DEFAULT First color
115. r a bar code to be printed 73 arcode addSymbol Adds a tag for a 2D Code to be printed 78 addPageBegin Adds a tag for switching to page mode 83 addPageEnd Adds a tag for finishing page mode 84 addPageArea Adds a tag for specifying the print area in 85 page mode A tag f ifying th int direction i r dds a tag for specifying the print direction in 87 Pagemode page mode addPagePosition Adds a tag for specifying the print position in 89 page mode addPageLine Adds a tag for drawing a line in page mode 91 ddaPageRectangie Adds a tag for drawing a rectangle in page 93 mode Cut addCut Adds a tag for paper cut 95 Drawer kick out addPulse Adds a tag for the drawer kick out 96 oreo Sets the buzzer sounding cycle and adds it to For setting cycle 97 Buzzer the command buffer buzzer addSound Adds a tag for turning on the buzzer 99 Paper Layout addLayout Adds a tag for paper layout information 102 Send Command addCommand Adds a tag for inserting commands 104 Print class Chapter 4 API Reference Controls the printer by sending a print document created using the Builder class and monitors the transmission result and the communication status Constructor Initialize a Print class instance 105 Initialize a Print class instance Constructor For log output i i 106 This constructor is for the log output function openPrinter Starts communications with the printer
116. rawable 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 72 Chapter 3 Programming Guide To create a page mode print document The page mode starts by storing addPageBegin p 83 of the Builder class into a command buffer Store the print area addPageArea p 85 and the print start position addPagePosition p 89 in command buffers Specify the print start position according to the print data Then store APIs in command buffers and create print data For the page mode end store addPageEnd p 84 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 cots Origin of horizontal axis 100 origin of vertical axis 50 width 200 height 100 e Page mode print positions in dots Horizontal print position O vertical print position 42 e Font FontA e Scale x 2 horizontal and x 2 vertical e Style Bold try Initialize a Builder class instance Builder builder new Builder TM T88V Builder MODEL_ANK Create a print document lt The page mode starts gt builder addPageBe
117. ryStatusChangeEventListener Process private void onBatteryStatusChangeEvent String deviceName int battery Process private void openPrinter Print printer new Print printer setBatteryStatusChangeEventCallback this try printer openPrinter Print DEVTYPE_TCP 192 168 192 168 Print TRU Print PARAM DEFAULT Process catch EposException e int errStatus e getErrorStatus OG 143 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 printer openPrinter Print DEVTYPE_TCP 192 168 192 168 catch EposException e int errStatus e getErrorStatus if errStatus EposException ERR_OPEN Process 144 Chapter 4 API Reference getPrinterStatus Acquires the printer status from an exception that occurred in sendData p 112 Syntax public int getPrinterStatus Return value Returns the printer status A combination of printer status settings is set For details refer to Printer Status List p 43 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
118. s 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 83 84 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 83 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 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 addTex
119. s EpsonloException 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 no device port was open loStatus ERR_PROCESSING Could not execute process loStatus ERR_FAILURE An unspecified error occurred 161 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 equates to 10 minutes e Take the transmission speed and volume of data to be sent into account when specifying AN 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 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 valu
120. s called ERR_ILLEGAL Could not execute process lt Example gt Could not execute the process because an identical process is being executed in another thread ERR_PROCESSING An unsupported model name or language specification was specified ERR_OFF_LINE The printer is offline ERR_FAILURE An unspecified error occurred ERR_UNSUPPORTED Chapter 3 Programming Guide Printer Status List iS No response from the printer Ox00000001 A ee NOC ERS Printing is successfully completed Ox00000002 lt Other than TM P60 TM P60ll gt Print ST_DRAWER_KICK Status of the 3rd pin of the drawer kick out connector H Ox00000004 lt TM P60 TM P60ll gt Print ST_BATTERY_OFFLINE Battery offline status Ox00000004 a Status of the 3rd pin of the drawer kick out connector H Print ST_OFF_LINE 0x00000008 ig Print ST_COVER_OPEN fhe covensenen Ox00000020 a T a Paper is being fed by a paper feed switch operation A Waiting to be brought back online pre as ion The paper feed switch is being pressed ON E IAN ARES A mechanical error occurred Ox00000400 ES EOC UIER ERS An autocutter error occurred Ox00000800 P COMES An unrecoverable error occurred Ox00002000 BO ES ORES Eee An automatically recoverable error occurred Ox00004000 Pint EN No paper in roll paper near end sensor Ox00020000 A e No paper in roll paper end sensor Ox
121. 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 Printer specifications p 165 1 2D code printing For 2D code that can be printed by each model refer to Printer specifications p 165 1 Drawer kick function 1 Buzzer function d Paper layout setting d Label black mark paper feed setting LY ESC POS command transmission 1 Acquisition of response from printer printing result printer status battery status T Compatible with Asian languages simplified Chinese traditional Chinese Korean Thai Vietnamese Printer Search API T Search for printers 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 1 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 2 2 For the latest version refer to the README file NQ Android Device Device that supports ARMv5TE TM Printer TM T88V Vv Vv TM T20 Vv TM T70 Vv Vv TM T70ll Vv Vv
122. t Send data for confirmation gt 3 printer sendData conBuilder 10000 status amp Print ST_OFF_LINE Print ST_OFF_LINE lt Send print data gt printer sendData builder 10000 status lt End communication with the printer gt printer closePrinter catch EposException e int errStatus e getErrorStatus status 0 e getPrinterStatus printer closePrinter w Create print data To check the printer status send empty print data Send the print data created in 2 AWN send the print data created in 1 If the print data created in 2 was properly sent and the printer is online then 35 Automatic Acquisition of Printer Status 36 In ePOS Print SDK listener is used to automatically 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 j Process private void openPrinter Initialize the print class instance Print printer new Print Register the notification destination of printer status changes printer setStatusChangeEventCallback this Ex Start communicatio
123. t method Specify a print area to cover the content to be printed If the print data extends beyond the print area the print result will be such that the print data has been printed incompletely 2 Use this API function by inserting it between addPageBegin p 83 and addPageEnd p 84 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 AN the print data might not be printed completely 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 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
124. tCallback 128 setPaperNearEndEventCallback 180 setPaperEndEventCallback 132 setDrawerClosedEventCallback 134 setDrawerOpenEventCallback 136 EposException Class getErrorStatus 144 getPrinterStatus 145 All the command transmission reception APIs are supported NQ 190
125. tStyle Builder FALSE Builder FALSE Builder TRUE Builder PARAM UNSPECIFIED lt Specify the print data gt builder addText Hello t builder addText World n builder addCut Builder CUT_FEED Send a print document lt Start communication with the printer gt printer openPrinter Print DEVTYPE_TCP 192 168 192 168 lt Send data gt printer sendData builder 10000 status lt End communication with the printer gt printer closePrinter int errStatus e getErrorStatus status 0 e getPrinterStatus printer closePrinter 34 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 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 Builder conBuilder new Builder TM T88V Builder MODEL_ANK lt Start communication with the printer gt printer openPrinter Print DEVTYPE_TCP 192 168 192 168 l
126. the command transmission reception APIs are supported Q 184 Appendix TM T81Il 80mm Interface Ethernet 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 Bar Code 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 185 List of Supported ePOS Print APIs ePOS Print API ePOS Print API Builder Class Constructor 48 Constructor Forlogoutput 5 clearCommancBuffer 52 addTextAlign 53 adaTextlineSpace 54 addTextRotate 55 addText 56 addTextLang 57 adaTextFont 58 addText mooth 59 adaTextDouble 60 adaTextsSize 61 adaTextStyle 62 adaTextPosition 64 addFeedunit
127. the ePOS Print SDK for Android 2 This explanation uses Eclipse If you are using another development environment please make the appropriate changes Incorporate the SDK using following procedures 1 2 0 Create a new project in Eclipse Copy provided JAR file ePOS Print jar into following path Uibs 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 Copy the library file libeposprint so into following path Libs Larmeabi Lilibeposprint so Select the project in Eclipse s Package Explorer right click on it and press Refresh Write the package import declaration in the java source file s of the application you would like to use this SDK in as follows import com epson eposprint import com epson epsonio 27 28 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 pe Compiler screen is displayed Set the Compiler compliance level to 1 6 and click Apply After that
128. ti 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 MAC address of the device that is notified of paper near end event is set Chapter 4 API Reference 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 TRU Print PARAM DEFAULT Process catch EposException e int errStatus e getErrorStatus OG 131 132 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 p 107 When this API is executed on multiple occasions the notification destination that is specified afterwards is overwritten 2 e This API can be executed following execution of openPrinter For acquiring printer status Syntax public void setPaperEndEventCallback PaperEndEventListener target Parameter e target This specifies th
129. tion method Notification destination registration API public interface StatusChangeEventListener extends EventListener Printer status notification void onStatusChangeEvent String deviceName int status setStatusChangeEventCallback p 116 public interface OnlineEventListener extends EventListener Online notification void onOnlineEvent String deviceName setOnlineEventCallback p 118 public interface OfflineEventListener extends EventListener Offline notification void onOfflineEvent String deviceName setOfflineEventCallback p 120 public interface PowerOffEventListener extends EventListener Power off notification void onPowerOffEvent String deviceName setPowerOffEventCallback p 122 public interface CoverOkEventListener extends EventListener Cover close notification void onCoverOkEvent String deviceName setCoverOkEventCallback p 124 public interface CoverOpenEventListener extends EventListener Cover open notification void onCoverOpenEvent String deviceName setCoverOpenEventCallback p 126 public interface PaperOkEventListener extends EventListener Paper OK notification void onPaperOkEvent String deviceName setPaperOkEventCallback p 128 public interface PaperNearEndEventListener extends EventListener Paper near end notification void onPaperNearEndEvent String deviceName setPaperNearEndEventCallback p 130 public interface PaperEndEventListener extends Event
130. tions 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 enable smoothing try Builder builder new Builder TM T88V Builder MODEL_ANK builder addText Smooth Builder TRUE Process catch EposException e int errStatus e getErrorStatus 59 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 SS Retains the current setting e dh Specifies the double sized height Builder TRUE Specifies the double sized height Builder FALSE default Cancels the double sized height A Retains the current setting When Builder true or 1 is set for both the dw and dh parameters double width and height Q 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 w
131. uilder MODEL_ANK Builder BARCODE_UPC_A 2 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 64 ne e ne Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED me Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED ne Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED me Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED ne Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED ne Builder PARAM UNSPECIFIED Builder PARAM UNSPECIFIED 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 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 E
132. 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 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 MODE_ MONO Builder HALFTONE DITHER 1 0 builder addPageEnd Process catch EposException e int errStatus e getErrorStatus 69 70 addlmage Adds raster image printing to the command buffer 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 image corresponds to 1 dot of the printer If transparent shading is includea it is regarded as white When printing in multiple tone use addlmage For multiple tone printing p 67 Q To print a raster image at high speed specify Builder ALIGN_LEFT for the addTextAlign p 53 and specify a
133. uted on multiple occasions the notification destination that is specified afterwards is overwritten 2 This API can be executed following execution of openPrinter For acquiring printer status 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 MAC address of the device that is notified of printer status is set e status Printer status is set Chapter 4 API Reference 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 TRU Print PARAM DEFAULT Process catch EposException e int errStatus e getErrorStatus OG 117
134. ventCallback 118 setOfflineEveniCallback 120 setPowerOffEventCallback 122 setCoverOkEveniCallback 124 setCoverOpenEventCallback 126 setPaperOkEventCallback 128 setPaperNearEndEventCallback 130 setPaperEndEventCallback 132 setDrawerClosedEventCallback 134 setDrawerOpenEventCallback 136 EposException Class getErrorStatus 144 getPrinterStatus 145 All the command transmission reception APIs are supported N 182 Appendix TM T20 58mm 80mm Interface Ethernet 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 Area 420 dots x 1662 dots W x H 576 dots x 1662 dots W x H Bar Code 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 Stac
135. xtends 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 125 126 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 p 107 When this API is executed on multiple occasions the notification destination that is specified afterwards is overwritten 2 This API can be executed following execution of openPrinter For acquiring printer status 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 soecified 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 deviceName The identifier IPv4 type IP address MAC
136. y Specify the directory where you extracted the sample program zip file Copy projects into workspace Check this option 4 In Package Explorer view right click on the ePOSPrintSample project and select Properties 5 The Properties for ePOSPrintSample window will be displayed Make the settings shown below and click OK Android Select the Android OS version of the target device In Libraries confirm that the path to ePOS Print jar which is Java Build Path located in the ePOSPrintSample project that was copied into the project workspace is set 6 In Package Explorer view right click on the ePOSPrintSample project and select Run As Android Application Y The sample program will be installed to the target Android device and then the program will start up How to Use the Program Sample 18 This section describes how to use the program sample for the following operations e Search for printers and printing p 18 e Acquisition of Printer Model Name p 25 Search for printers and printing Use the sample program as follows 1 2 Start the sample program For details refer to Environmental Construction p 17 Search for printers Tap Printer Discovery on the main screen When you select Device Type the IP addresses Mac addresses for the detected printers are listed Select the IP address Mac address of the printer you want to use from the list of IP addresses
137. y an integer within the Q range Log LOG_DISABLE Log LOG_TCP e logLevel Specifies the level of log data to be output Set value Description 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 153 154 Example To output log data to port 8080 IP address 192 168 192 168 over TCP try Log setLogSettings getApplicationContext Log LOG_TCP catch EposException e int errStatus e getErrorStatus status 0 e getPrinterStatus 192 168 192 168 Log LOG_PERMANENT 8080 10 Log LOG_LOW To output log data to the device s storage try Log setLogSettings getApplicationContext Log LOG_STORAGE null 0 catch EposException e int errStatus e getErrorStatus status 0 e getPrinterStatus Log LOG_PERMANENT 10 Log LOG_ LOW To disable the log output function try Log setLogSettings getApplicationContext Log LOG DISABLE null 0 catch EposException e int errStatus e getErrorStatus status 0 e getPrinterStatus Log LOG_PERMANENT 10 Log LOG_ LOW Chapter 5 Command Transmission Reception Command Transmission Reception This chapter describes APIs for transmission and reception of commands ESC POS commands etc g
138. z TM T82 Vv a TM T82Il Vv F TM T8111 Vv z z TM T9OII Vv Vv a TM P60 Receipt Wi Fi Y TM P60 Receipt Bluetooth V TM P60 Peeler Wi Fi Y TM P60 Peeler Bluetooth Vv TM P60ll Receipt Wi Fi Vv TM P 6OII Receipt Bluetooth Vv TM P60II Peeler Wi Fi Y TM P60li Peeler Bluetooth Y TM U220 Series Y Y 12 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 1 Overview Contents in the Package Package O eee Compiled Java class file archived into a jar format file to allow ePOS Print jar APIs to be used from Java programs llbeposprint so Library for function execution ARMVv5TE supported ePOS Print_Sample_Anaroid 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 Contains the SOFTWARE LICENSE AGREEMENT The Japanese language edition ePOS Print_SDK_Android_E_Revx odf This manual ePOS Print_SDK_Android_J_Revx paf The Japanese language edition of this manual EULA jp txt The following manuals are available for ePOS Print SDK for Android d ePOS Print SDK for Android User s Manual This Document 1 ePOS Print SDK for Android Application Development Setup Guide Sample Program For an An
Download Pdf Manuals
Related Search
Related Contents
Manual de uso y técnica MDHP Ethernet Option Manual Code du Gestionnaire SERVICE MANUAL MSZ-A18YV - MSZ-A24YV - MSZ-A26YV PRONTUÁRIO ELETRÔNICO SIMPLIFICADO KD-R601 FWEB manual - (La)TeX Navigator Manual de Instrucciones Copyright © All rights reserved.
Failed to retrieve file