API 레퍼런스가이드 BXL SDK for UPOS Compliant Android Rev. 2.02 SPP-R210 SPP- R220 / R200II / R200III SPP-R300 / R310 SPP-R400 / R410 / R418 SRP-275III SRP-330II / 332II SRP-340II / 342II SRP-350III / 352III / 350plusIII / 352plusIII SRP-380 / 382 SRP-F310II / F312II / F313II SRP-S300 SRP-Q300 / Q302 SRP-QE300 / QE302 SRP-E300 / E302 STP-103III http://www.bixolon.com
목차 1. 매뉴얼안내... 4 2. 지원 OS 및인터페이스... 4 2-1 운영체제... 4 2-2 지원장치및인터페이스... 4 3. 개발환경... 5 3-1 환경설정... 5 3-2 Android 장치연결... 5 3-2-1 Bluetooth... 5 3-2-2 Network... 6 3-2-3 Wi-Fi Direct... 7 3-2-4 USB... 8 3-2-5 Android 장치개발자옵션설정... 12 4. 패키지콘텐츠... 13 4-1 매뉴얼... 13 4-2 라이브러리... 13 4-3 샘플소스코드... 14 5 상수값 (Defines)... 15 5-1 JposException... 15 5-2 Event... 16 5-2-1 StatusUpdate Event... 16 5-2-2 Error Event... 16 5-2-3 OutputComplete Event... 16 5-2-4 Data Event... 16 5-3 EscapeSequence... 19 5-4 Transaction Print... 20 5-5 Alignment... 21 5-6 바코드타입... 22 5-7 바코드텍스트위치... 23 5-8 장치모델명... 23 5-9 페이지모드인쇄방향... 24 5-10 MSR 암호화... 24 5-11 SCR 모드... 24 5-12 Character Set... 25 6. 각클래스별기능정리... 26 6-1 BXLConfigLoader Class... 26 6-1-1 openfile()... 26 6-1-2 newfile()... 26 6-1-3 getentries()... 27 6-1-4 adden()... 28 6-1-5 removeen()... 29 6-1-6 savefile()... 30 6-2 POSPrinter Class... 31 6-2-1 open()... 31 6-2-2 claim()... 32 6-2-3 setdeviceenabled()... 33 6-2-4 release()... 33 6-2-5 close()... 34 6-2-6 checkhealth()... 34 6-2-7 setasyncmode()... 35 Rev. 2.02-2 -
6-2-8 setcharacterset()... 36 6-2-9 setcharacterencoding()... 37 6-2-10 cutpaper()... 38 6-2-11 printbarcode()... 39 6-2-12 printbitmap()... 40 6-2-13 printbitmap()... 41 6-2-14 printnormal()... 42 6-2-15 printpdf()... 43 6-2-16 printpdf()... 44 6-2-17 setpagemodeprintarea()... 45 6-2-18 setpagemodeprintdirection()... 46 6-2-19 pagemodeprint()... 47 6-2-20 setpagemodehorizontalposition()... 48 6-2-21 setpagemodeverticalposition()... 49 6-2-22 transactionprint()... 50 6-2-23 displaystring()... 51 6-2-24 cleanscreen()... 52 6-2-25 storeimagefile()... 53 6-2-26 displayimage()... 54 6-2-27 clearimage()... 55 6-3 MSR Class... 56 6-3-1 open()... 56 6-3-2 claim()... 57 6-3-3 setdeviceenabled()... 58 6-3-4 release()... 59 6-3-5 close()... 59 6-3-6 setautodisable()... 60 6-3-7 setdataeventenabled()... 61 6-3-8 setdataencryptionalgorithm()... 62 6-3-9 gettrack1data()... 63 6-3-10 gettrack2data()... 64 6-3-11 gettrack1data()... 65 6-4 SmartCardRW Class... 66 6-4-1 open()... 66 6-4-2 claim()... 67 6-4-3 setdeviceenabled()... 68 6-4-4 release()... 68 6-4-5 close()... 69 6-4-6 setscslot()... 70 6-4-7 setisoemvmode()... 71 6-4-8 readdata()... 72 6-5 CashDrawer Class... 73 6-5-1 open()... 73 6-5-2 claim()... 74 6-5-3 setdeviceenabled()... 75 6-5-4 release()... 75 6-5-5 close()... 76 6-5-6 opendrawer()... 76 6-5-7 getdraweropened()... 77 7. 사용예제... 78 7-1 텍스트인쇄... 78 7-2 이미지인쇄... 79 7-3 PDF 파일인쇄... 80 7-4 Page mode 인쇄... 81 Rev. 2.02-3 -
1. 매뉴얼안내 이 SDK 매뉴얼에는 Android 용응용프로그램개발에필요한 Library 에대한내용이기술되어있습니다. SDK 의사용방법, 사양, 제약에대해설명합니다. 2. 지원 OS 및인터페이스 2-1 운영체제 이소프트웨어는아래운영체제를지원합니다. Android 4.0 (Ice Cream Sandwich) 이상 2-2 지원장치및인터페이스 Models SPP-R200II SPP-R200III SPP-R210 SPP-R220 SPP-R300 SPP-R310 SPP-R400 SPP-R410 SPP-R418 SRP-350plusIII SRP-352plusIII SRP-350III SRP-352III SRP-F310II SRP-F312II SRP-F313II SRP-380 SRP-382 SRP-330II SRP-332II SRP-S300 SRP-340II SRP-342II STP-103III SRP-275III SRP-Q300 SRP-Q302 SRP-QE300 SRP-QE302 SRP-E300 SRP-E302 BLE: Bluetooth Low Energy Interface Bluetooth / WLAN / USB Bluetooth / WLAN / USB Bluetooth / WLAN / USB Bluetooth / BLE / WLAN / USB Bluetooth / WLAN / USB Bluetooth / WLAN / USB Bluetooth / WLAN / USB Bluetooth / BLE / WLAN / USB Bluetooth / BLE / WLAN / USB Bluetooth / WLAN / Ethernet / USB Bluetooth / WLAN / Ethernet / USB Ethernet / USB Ethernet / USB Bluetooth / WLAN / Ethernet / USB Bluetooth / WLAN / Ethernet / USB Bluetooth / WLAN / Ethernet / USB Bluetooth / WLAN / Ethernet / USB Bluetooth / WLAN / Ethernet / USB Ethernet / USB Ethernet / USB Bluetooth / WLAN / Ethernet / USB Ethernet / USB Ethernet / USB USB Ethernet / USB Bluetooth / WLAN / Ethernet / USB Bluetooth / WLAN / Ethernet / USB Ethernet / USB Ethernet / USB Ethernet / USB Ethernet / USB Rev. 2.02-4 -
3. 개발환경 3-1 환경설정 Java Development Kit (JDK) 7 Eclipse Android SDK Tools 참고 : http://developer.android.com/sdk/index.html 3-2 Android 장치연결 아래스크린샷은 Nexus 5 에서캡쳐한것입니다. 스크린샷과항목이름은 Android 운영체제또는장치에따라다를수있습니다. 3-2-1 Bluetooth 1. Settings 를선택합니다. 2. 반드시 Bluetooth 가켜져있고, 프린터의전원이켜져있어야합니다. 3. 설정을위해 Bluetooth 를선택합니다. 4. Scan 을선택합니다. 연결하기위한프린터를검색하고페어링합니다. 5. PIN code 를입력합니다. 빅솔론의초기 PIN code 는 0000 입니다. Rev. 2.02-5 -
3-2-2 Network 1. 프린터를네트워크 AP(Access Point) 에연결하고 IP 주소를할당하거나 DHCP 로설정합니다. 빅솔론의프린터는초기에 Ad-hoc 으로설정되어있기때문에, 당사 Net Configuration Tool 로최초한번은설정을해야됩니다. Net Configuration Tool 은 빅솔론의웹사이트에서다운로드가능합니다. ( 설정과관련된자세한사항은 Net Configuration Tool 매뉴얼참고 ) 2. Settings 를선택합니다. 3. Wi-Fi 가켜져있어야합니다. 4. 빅솔론의프린터가연결되어있는네트워크와동일한네트워크에연결합니다. 5. 안드로이드장치를프린터의 TCP/IP 포트에연결하기위해추가설정은필요하지않습니다. Rev. 2.02-6 -
3-2-3 Wi-Fi Direct 1. 안드로이드장치는 OS 버전 4.0 이상부터 Wi-Fi Direct 로주변장치연결이가능합니다. 2. 안드로이드장치에 빅솔론의특정드라이버나프린터소프트웨어가설치되어있을필요는없습니다. 3. Settings 를선택합니다. 4. Wi-Fi 가켜져있어야합니다. 5. Wi-Fi Direct 를선택합니다. 6. 검색된프린터를선택해서연결합니다. Wi-Fi Direct 초기 PIN 번호는 12345678 입니다. Rev. 2.02-7 -
3-2-4 USB 1. 안드로이드장치는 OS 버전 3.1 이상부터 USB 주변장치연결이가능합니다. 2. 안드로이드장치에 빅솔론의특정드라이버나프린터소프트웨어가설치되어있을필요는없습니다. 3. 필요한 USB 케이블은안드로이드장치에따라달라질수있습니다. 사용하려는안드로이드장치가 USB 연결을지원하는지확인후알맞은케이블을사용하시기바랍니다. 4. 빅솔론의프린터를처음연결하는경우, 안드로이드장치에따라서아래와같은메시지가나타날수있습니다. Rev. 2.02-8 -
5. USB 주변장치를연결하기위해서는아래코드를 AndroidManifest.xml 과 Sample 로제공되는 BXLTest 내 res/xml/device_filter.xml 에입력해야합니다. [AndroidManifest.xml] <uses-feature android:name="android.hardware.usb.host" /> <intent-filter> <action /> </intent-filter> android:name="android.hardware.usb.action.usb_device_attached" <meta-data android:name="android.hardware.usb.action.usb_device_attached" android:resource="@xml/device_filter" /> Rev. 2.02-9 -
[device_filter.xml] <?xml version="1.0" encoding="utf-8"?> <resources> <!-- SPP-R200II --> <usb-device product-id="40" vendor-id="5380" /> <!-- SPP-R200III --> <usb-device product-id="91" vendor-id="5380" /> <!-- SPP-R210 --> <usb-device product-id="81" vendor-id="5380" /> <!-- SPP-R220 --> <usb-device product-id="106" vendor-id="5380" /> <!-- SPP-R300 --> <usb-device product-id="33" vendor-id="5380" /> <!-- SPP-R310 --> <usb-device product-id="92" vendor-id="5380" /> <!-- SPP-R400 --> <usb-device product-id="41" vendor-id="5380" /> <!-- SPP-R410 --> <usb-device product-id="75" vendor-id="5380" /> <!-- SPP-R418 --> <usb-device product-id="93" vendor-id="5380" /> <!-- SRP-350plusIII --> <usb-device product-id="61" vendor-id="5380" /> <!-- SRP-352plusIII --> <usb-device product-id="62" vendor-id="5380" /> <!-- SRP-350III --> <usb-device product-id="43" vendor-id="5380" /> <!-- SRP-352III --> <usb-device product-id="60" vendor-id="5380" /> <!-- SRP-F310II --> <usb-device product-id="87" vendor-id="5380" /> <!-- SRP-F312II --> <usb-device product-id="88" vendor-id="5380" /> <!-- SRP-F313II --> <usb-device product-id="90" vendor-id="5380" /> Rev. 2.02-10 -
<!-- SRP-380 --> <usb-device product-id="96" vendor-id="5380" /> <!-- SRP-382 --> <usb-device product-id="97" vendor-id="5380" /> <!-- SRP-330II --> <usb-device product-id="110" vendor-id="5380" /> <!-- SRP-332II--> <usb-device product-id="111" vendor-id="5380" /> <!-- SRP-S300--> <usb-device product-id="82" vendor-id="5380" /> <!-- SRP-340II --> <usb-device product-id="114" vendor-id="5380" /> <!-- SRP-342II --> <usb-device product-id="115" vendor-id="5380" /> <!-- STP-103III --> <usb-device product-id="83" vendor-id="5380" /> <!-- SRP-275III --> <usb-device product-id="89" vendor-id="5380" /> <!-- SRP-Q300 --> <usb-device product-id="86" vendor-id="5380" /> <!-- SRP-Q302 --> <usb-device product-id="89" vendor-id="5380" /> <!-- SRP-QE300 --> <usb-device product-id="153" vendor-id="5380" /> <!-- SRP-QE302 --> <usb-device product-id="154" vendor-id="5380" /> <!-- SRP-E300 --> <usb-device product-id="152" vendor-id="5380" /> <!-- SRP-E302 --> <usb-device product-id="156" vendor-id="5380" /> </resources> Rev. 2.02-11 -
3-2-5 Android 장치개발자옵션설정 1. Settings를선택합니다. 2. Developer options를선택합니다. 3. USB debugging을활성화합니다. Rev. 2.02-12 -
4. 패키지콘텐츠 4-1 매뉴얼 매뉴얼위치 / 이름 docs/manual_bxl SDK for Android_UPOS compliant API Reference Guide_english_Rev_x_xx docs/manual_bxl SDK for Android_UPOS compliant API Reference Guide_japan_Rev_x_xx docs/manual_bxl SDK for Android_UPOS compliant API Reference Guide_korean_Rev_x_xx docs/manual_bxl SDK for Android_UPOS compliant API Reference Guide_chinese_Rev_x_xx 설명영문매뉴얼일본어매뉴얼한글매뉴얼중국어매뉴얼 4-2 라이브러리 라이브러리위치 / 이름 libs/bixolon_printer_vxxx.jar libs/jpos11x-controls.jar libs/xerces.jar libs/icu4j-58_1.jar libs/pdf/bixolon_pdf.jar libs/pdf/cpu type/libbxlpdf.so libs/image/opencv-2.4.11.jar libs/image/cpu type/libopencv_java.so 설명 JavaPOS 서비스컴포넌트계층의구현. 프린터설정라이브러리 JavaPOS 장치컨트롤과서비스인터페이스 apache.org XML 서비스구현 (JavaPOS device control에서필요 ) 아랍어 / 페르시아어문자를인쇄하기위해사용되는라이브러리 PDF 인쇄를위한라이브러리 PDF 인쇄를위한 native 라이브러리 Image 인쇄를위한라이브러리 Image 인쇄를위한 native 라이브러리 Rev. 2.02-13 -
4-3 샘플소스코드 샘플위치 / 이름 samples/bitmaptest samples/bxlcustomerdisplay samples/bxltest samples/eventtest samples/farsitest samples/pdftest samples/textdatatest 설명비트맵인쇄샘플애플리케이션 BCD-3000 텍스트, 이미지출력샘플애플리케이션 (SRP-Q300/Q302 Display port에연결된장치에한함 ) 프린터설정, 프린터연결, 텍스트, 바코드, 비트맵인쇄, 페이지모드설정샘플애플리케이션 Status/Error/OutputComplete Event 샘플애플리케이션아랍어및페르시아어인쇄샘플애플리케이션 PDF 인쇄샘플애플리케이션텍스트인쇄옵션설정샘플애플리케이션 Rev. 2.02-14 -
5 상수값 (Defines) 5-1 JposException Method 에서특정기능수행중에러발생시 JposException 예외를발생시킵니다. 예외발생시 printstacktrace 함수를통해에러내용을확인할수있습니다. import jpos.jposconst; // Error Rev. 2.02-15 -
5-2 Event 각 Event 는 JposConst, POSPrinterConst 클래스에정의되어있습니다. 5-2-1 StatusUpdate Event 프린터상태가변경될때마다 StatusUpdate 이벤트가발생합니다. 상수명 값 설명 JPOS_SUE_POWER_ONLINE 2001 Printer Power on JPOS_SUE_POWER_OFF_OFFLINE 2004 Printer Power off PTR_SUE_COVER_OPEN 11 Cover Open PTR_SUE_COVER_OK 12 Cover OK PTR_SUE_REC_EMPTY 24 Receipt Paper Empty PTR_SUE_REC_NEAREMPTY 25 Receipt Paper Near Empty PTR_SUE_REC_PAPEROK 26 Receipt Paper OK PTR_SUE_IDLE 1001 Printer Idle PTR_SUE_OFF_LINE 53 Printer off-line PTR_SUE_ON_LINE 54 Printer on-line PTR_SUE_BAT_OK 55 Printer battery normal PTR_SUE_BAT_LOW 56 Printer battery low 5-2-2 Error Event 상수명 값 설명 JPOS_EPTR_COVER_OPEN 201 Cover Open JPOS_EPTR_REC_EMPTY 203 Paper Empty JPOS_EPTR_OFF_LINE 217 Printer off-line 5-2-3 OutputComplete Event 인쇄완료이벤트를발생시킵니다. 단, Async 모드로사용해야합니다. 5-2-4 Data Event Direct I/O 의응답및 MSR Track 정보등의데이터를수신합니다. SDK for Android UPOS Rev. 2.02-16 -
[Event Example] POSPrinter posprinter = new POSPrinter(this); MSR msr = new MSR(); posprinter.adderrorlistener(this); posprinter.addstatusupdatelistener(this); posprinter.addoutputcompletelistener(this); msr.adddatalistener(this); posprinter.setasyncmode(true); // Error @Override public void outputcompleteoccurred(final OutputCompleteEvent e) runonuithread(new Runnable() @Override public void run() Toast.makeText(MainActivity.this, "complete print", Toast.LENGTH_SHORT).show(); ); @Override public void dataoccurred(dataevent arg0) // TODO Auto-generated method stub runonuithread(new Runnable() @Override public void run() String strdata = new String(msr.getTrack1Data()); strdata += new String(msr.getTrack2Data()); strdata += new String(msr.getTrack3Data()); Toast.makeText(MainActivity.this, strdata, Toast.LENGTH_SHORT).show(); Toast.makeText(MainActivity.this, e.getmessage(), Toast.LENGTH_SHORT).show(); ); Rev. 2.02-17 -
@Override public void erroroccurred(final ErrorEvent arg0) // TODO Auto-generated method stub runonuithread(new Runnable() @Override public void run() switch (arg0.geterrorcodeextended()) case POSPrinterConst.JPOS_EPTR_COVER_OPEN: return "Cover open"; case POSPrinterConst.JPOS_EPTR_REC_EMPTY: return "Paper empty"; case JposConst.JPOS_SUE_POWER_OFF_OFFLINE: return "Power off"; default: return "Unknown"; ); @Override public void statusupdateoccurred(final StatusUpdateEvent arg0) // TODO Auto-generated method stub runonuithread(new Runnable() @Override public void run() switch (arg0.getstatus()) case JposConst.JPOS_SUE_POWER_ONLINE: return "Power on"; case JposConst.JPOS_SUE_POWER_OFF_OFFLINE: return "Power off"; case POSPrinterConst.PTR_SUE_COVER_OPEN: return "Cover Open"; case POSPrinterConst.PTR_SUE_COVER_OK: return "Cover OK"; case POSPrinterConst.PTR_SUE_REC_EMPTY: return "Receipt Paper Empty"; case POSPrinterConst.PTR_SUE_REC_NEAREMPTY: return "Receipt Paper Near Empty"; case POSPrinterConst.PTR_SUE_REC_PAPEROK: return "Receipt Paper OK"; case POSPrinterConst.PTR_SUE_IDLE: return "Printer Idle"; case POSPrinterConst.PTR_SUE_BAT_LOW: return "Battery-Low"; case POSPrinterConst.PTR_SUE_BAT_OK: return "Battery-OK"; default: return "Unknown"; ); Rev. 2.02-18 -
5-3 EscapeSequence 인쇄할텍스트에폰트, 굵기등의옵션을지정하기위한값입니다. 문자열형식이며인쇄데이터앞에추가하여사용합니다. SDK for Android UPOS 정의 String ESCAPE_CHARACTERS = new String(new byte[] 0x1b, 0x7c) ESCAPE_CHARACTERS + "N" ESCAPE_CHARACTERS + "am" ESCAPE_CHARACTERS + "bm" ESCAPE_CHARACTERS + "cm" ESCAPE_CHARACTERS + "la" ESCAPE_CHARACTERS + "ca" ESCAPE_CHARACTERS + "ra" ESCAPE_CHARACTERS + "bc" ESCAPE_CHARACTERS + "!bc" ESCAPE_CHARACTERS + "uc" ESCAPE_CHARACTERS + "!uc" ESCAPE_CHARACTERS + "rvc" ESCAPE_CHARACTERS + "!rvc" ESCAPE_CHARACTERS + "1C" ESCAPE_CHARACTERS + "2C" ESCAPE_CHARACTERS + "3C" ESCAPE_CHARACTERS + "4C" ESCAPE_CHARACTERS + "1hC" ESCAPE_CHARACTERS + "2hC" ESCAPE_CHARACTERS + "3hC" ESCAPE_CHARACTERS + "4hC" ESCAPE_CHARACTERS + "5hC" ESCAPE_CHARACTERS + "6hC" ESCAPE_CHARACTERS + "7hC" ESCAPE_CHARACTERS + "8hC" ESCAPE_CHARACTERS + "1vC" ESCAPE_CHARACTERS + "2vC" ESCAPE_CHARACTERS + "3vC" ESCAPE_CHARACTERS + "4vC" ESCAPE_CHARACTERS + "5vC" ESCAPE_CHARACTERS + "6vC" ESCAPE_CHARACTERS + "7vC" ESCAPE_CHARACTERS + "8vC" 설명 Escape Characters Normal Font A (12x24) Font B (9x17) Font C (9x24) Left justify Center Right justify Bold Disabled bold Underline Disabled underline Reverse video Disabled reverse video Single high and wide Double wide Double high Double high and wide Scale 1 time horizontally Scale 2 times horizontally Scale 3 times horizontally Scale 4 times horizontally Scale 5 times horizontally Scale 6 times horizontally Scale 7 times horizontally Scale 8 times horizontally Scale 1 time vertically Scale 2 times vertically Scale 3 times vertically Scale 4 times vertically Scale 5 times vertically Scale 6 times vertically Scale 7 times vertically Scale 8 times vertically Rev. 2.02-19 -
POSPrinter posprinter = new POSPrinter(this); posprinter.open(logicaldevicename); posprinter.claim(0); posprinter.setdeviceenabled(true) String ESCAPE_CHARACTERS = new String(new byte[] 0x1b, 0x7c) // 진하게 String data = ESCAPE_SEQUENCE + "bc" + Bixolon\n posprinter.printnormal(posprinterconst.ptr_s_receipt, data); // 진하게해제 String data = ESCAPE_SEQUENCE + "!bc" + Bixolon\n posprinter.printnormal(posprinterconst.ptr_s_receipt, data); // Error 5-4 Transaction Print Transaction mode 설정시사용할수있는값에대한정의입니다. 상수명 값 설명 PTR_TP_TRANSACTION 11 Buffer를비어있는상태로초기화하고 Transaction Mode 를시작합니다 PTR_TP_NORMAL 12 Transaction mode 를종료하고, Buffer에쌓여있는 Data 를출력합니다. Rev. 2.02-20 -
5-5 Alignment 정렬을지정할때필요한값에대한정의입니다. [For Barcode] 상수명 값 설명 PTR_BC_LEFT -1 좌측정렬 PTR_BC_CENTER -2 중앙정렬 PTR_BC_RIGHT -3 우측정렬 [For Image] 상수명 값 설명 PTR_BM_LEFT -1 좌측정렬 PTR_BM_CENTER -2 중앙정렬 PTR_BM_RIGHT -3 우측정렬 [For PDF] 상수명 값 설명 PTR_PDF_LEFT -1 좌측정렬 PTR_PDF_CENTER -2 중앙정렬 PTR_PDF_RIGHT -3 우측정렬 Rev. 2.02-21 -
5-6 바코드타입 바코드출력시바코드지정에필요한값에대한정의입니다. 상수명 값 설명 PTR_BCS_UPCA 101 UPCA PTR_BCS_UPCE 102 UPCE PTR_BCS_JAN8 103 JAN8 PTR_BCS_EAN8 103 EAN8 PTR_BCS_JAN13 104 JAN13 PTR_BCS_EAN13 104 EAN13 PTR_BCS_TF 105 Standard(ordiscrete) 2 of 5 PTR_BCS_ITF 106 Interleaved 2 of 5 PTR_BCS_Codabar 107 Codabar PTR_BCS_Code39 108 Code39 PTR_BCS_Code93 109 Code93 PTR_BCS_Code128 110 SDK for Android UPOS Code 128 Code128 의 Special Character Special Charaters Ascii Represntation Code A A Code B B Code C C PTR_BCS_UPCA_S 111 UPC-A with supplemental barocde PTR_BCS_UPCE_S 112 UPC-E with supplemental barcode PTR_BCS_UPCD1 113 UPC-D1 PTR_BCS_UPCD2 114 UPC-D2 PTR_BCS_UPCD3 115 UPC-D3 PTR_BCS_UPCD4 116 UPC-D4 PTR_BCS_UPCD5 117 UPC-D5 PTR_BCS_EAN8_S 118 EAN8 with supplemental barocde PTR_BCS_EAN13_S 119 EAN13 with supplemental barocde PTR_BCS_EAN128 120 EAN128 PTR_BCS_OCRA 121 OCR A PTR_BCS_OCRB 122 OCR B PTR_BCS_Code128_Parsed 123 Code 128 with parsing PTR_BCS_GS1DATABAR 131 GS1 DataBar Omnidirectional PTR_BCS_GS1DATABAR_E 132 GS1 DataBar Stacked Omnidirectional PTR_BCS_GS1DATABAR_S 133 GS1 DataBar Expanded PTR_BCS_GS1DATABAR_E_S 134 GS1 DataBar Expanded Stacked PTR_BCS_PDF417 201 PDF 417 PTR_BCS_MAXICODE 202 MAXI Code PTR_BCS_DATAMATRIX 203 Data Matrix PTR_BCS_QRCODE 204 QR Code PTR_BCS_UQRCODE 205 Micro QR Code PTR_BCS_AZTEC 206 Aztec PTR_BCS_UPDF417 207 Micro PDF 417 Rev. 2.02-22 -
5-7 바코드텍스트위치 텍스트출력을지원하는바코드일경우, 바코드텍스트의출력여부또는위치를지정합니다. 상수명 값 설명 PTR_BC_TEXT_NONE -11 Text 를출력하지않습니다. 바코드만출력합니다. PTR_BC_TEXT_ABOVE -12 Text 를바코드의상단에출력합니다. PTR_BC_TEXT_BELOW -13 Text 를바코드의하단에출력합니다. 5-8 장치모델명 상수명 PRODUCT_NAME_SPP_R210 PRODUCT_NAME_SPP_R220 PRODUCT_NAME_SPP_R200II PRODUCT_NAME_SPP_R200III PRODUCT_NAME_SPP_R300 PRODUCT_NAME_SPP_R310 PRODUCT_NAME_SPP_R400 PRODUCT_NAME_SPP_R410 PRODUCT_NAME_SPP_R418 PRODUCT_NAME_SRP_350III PRODUCT_NAME_SRP_352III PRODUCT_NAME_SRP_330II PRODUCT_NAME_SRP_332II PRODUCT_NAME_SRP_340II PRODUCT_NAME_SRP_342II PRODUCT_NAME_SRP_350PLUSIII PRODUCT_NAME_SRP_352PLUSIII PRODUCT_NAME_SRP_380 PRODUCT_NAME_SRP_382 PRODUCT_NAME_SRP_S300 PRODUCT_NAME_SRP_Q300 PRODUCT_NAME_SRP_Q302 PRODUCT_NAME_SRP_F310II PRODUCT_NAME_SRP_F312II PRODUCT_NAME_SRP_F313II PRODUCT_NAME_STP_103III PRODUCT_NAME_SRP_275III PRODUCT_NAME_SRP_QE300 PRODUCT_NAME_SRP_QE302 PRODUCT_NAME_SRP_E300 PRODUCT_NAME_SRP_E302 설명 SPP-R210 SPP-R220 SPP-R200II SPP-R200III SPP-R300 SPP-R310 SPP-R400 SPP-R410 SPP-R418 SRP-350III SRP-352III SRP-330II SRP-332II SRP-340II SRP-342II SRP-350PLUSIII SRP-352PLUSIII SRP-380 SRP-382 SRP-S300 SRP-Q300 SRP-Q302 SRP-F310II SRP-F312II SRP-F313II STP-103III SRP-275III SRP-QE300 SRP-QE302 SRP-E300 SRP-E302 Rev. 2.02-23 -
5-9 페이지모드인쇄방향 상수명 값 설명 PTR_PD_LEFT_TO_RIGHT 1 왼쪽에서오른쪽으로인쇄 PTR_PD_BOTTOM_TO_TOP 2 아래에서위로인쇄 PTR_PD_RIGHT_TO_LEFT 3 오른쪽에서왼쪽으로인쇄 PTR_PD_TOP_TO_BOTTOM 4 위에서아래로인쇄 5-10 MSR 암호화 상수명 값 설명 MSR_DE_NONE 1 데이터암호화알고리즘사용안함 MSR_DE_3DEA_DUKPT 2 데이터암호화알고리즘사용 5-11 SCR 모드 상수명 값 설명 SC_CMODE_ISO 1 ISO 모드 SC_CMODE_EMV 2 EMV 모드 Rev. 2.02-24 -
5-12 Character Set 상수명 값 설명 CS_437_USA_STANDARD_EUROPE 437 PC437 CS_737_GREEK 737 PC737 CS_775_BALTIC 775 PC775 CS_850_MULTILINGUAL 850 PC850 CS_852_LATIN2 852 PC852 CS_855_CYRILLIC 855 PC855 CS_857_TURKISH 857 PC857 CS_858_EURO 858 PC858 CS_860_PORTUGUESE 860 PC860 CS_862_HEBREW_DOS_CODE 862 PC862 CS_863_CANADIAN_FRENCH 863 PC863 CS_864_ARABIC 864 PC864 CS_865_NORDIC 865 PC865 CS_866_CYRILLIC2 866 PC866 CS_928_GREEK 928 PC928 CS_1250_CZECH 1250 WPC1250 CS_1251_CYRILLIC 1251 WPC1251 CS_1252_LATIN1 1252 WPC1252 CS_1253_GREEK 1253 WPC1253 CS_1254_TURKISH 1254 WPC1254 CS_1255_HEBREW_NEW_CODE 1255 WPC1255 CS_1256_ARABIC 1256 WPC1256 CS_1257_BALTIC 1257 WPC1257 CS_1258_VIETNAM 1258 WPC1258 CS_FARSI 7065 FARSI CS_KATAKANA 7565 KATAKANA CS_KHMER_CAMBODIA 7572 KHMER CS_THAI11 8411 THAI11 CS_THAI14 8414 THAI14 CS_THAI16 8416 THAI16 CS_THAI18 8418 THAI18 CS_THAI42 8442 THAI42 CS_KS5601 5601 KS5601 CS_BIG5 6605 BIG5 CS_GB2312 2312 GB2312 CS_SHIFT_JIS 8374 SHIFT-JIS CS_TCVN_3_1 3031 TCVN-3(1) CS_TCVN_3_2 3032 TCVN-3(2) Rev. 2.02-25 -
6. 각클래스별기능정리 6-1 BXLConfigLoader Class 연결하고자하는장치설정정보를저장하기위한 Class 입니다. 설정정보는 BXLConfigLoader Class 를통해장치정보를관리합니다. 설정정보에는장치이름, 제품명, 인터페이스등이있으며해당정보가정상적으로저장되어있지않으면장치에연결할수없습니다. Open 함수를호출하기전에이클래스를호출하여설정정보를저장해야합니다. 주의 BXLConfigLoader 를통해저장되지않은장치는연결할수없습니다. 6-1-1 openfile() 기존저장된설정파일을 Open 합니다. void openfile() throws Exception import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; BXLConfigLoader bxlconfigloader = new BXLConfigLoader(this); bxlconfigloader.openfile(); catch(exception e) // Error 6-1-2 newfile() 새로운설정저장파일을생성합니다. 보통 openfile 예외발생시수행합니다. void newfile() throws Exception import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; BXLConfigLoader bxlconfigloader = new BXLConfigLoader(this); bxlconfigloader.openfile(); catch(exception e) bxlconfigloader.newfile(); Rev. 2.02-26 -
6-1-3 getentries() 저장된설정정보를얻어옵니다. List<JposEn> getentries() throws Exception [Return Values] 값 JposEn의 List 컨테이너 설명객체의리스트배열 import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; for (Object en : bxlconfigloader.getentries()) JposEn jposen = (JposEn)en; String strlogicalname = jposen.getlogicalname(); catch(exception e) Rev. 2.02-27 -
6-1-4 adden() 장치연결정보를추가합니다. void adden(string logicalname, int devicecategory, String productname, int devicebus, String address) throws IllegalArgumentException [Parameters] String logicalname : 장치의논리적이름 ( 별칭 ) 을입력합니다. int devicecategory : 장치의종류를선택합니다. 상수명 값 설명 DEVICE_CATEGORY_CASH_DRAWER 0 Cash Drawer DEVICE_CATEGORY_MSR 1 MSR DEVICE_CATEGORY_POS_PRINTER 2 POS Printer DEVICE_CATEGORY_SMART_CARD_RW 3 SCR String productname : 장치모델명 ( 5-8 장치모델명 참조 ) int devicebus : 인터페이스타입을선택합니다. 상수명 값 설명 DEVICE_BUS_BLUETOOTH 0 Bluetooth DEVICE_BUS_ETHERNET 1 Ethernet DEVICE_BUS_USB 2 USB DEVICE_BUS_WIFI 3 WiFi DEVICE_BUS_WIFI_DIRECT 4 WiFi-Driect DEVICE_BUS_BLUETOOTH_LE 5 Bluetooth Low Energy String address : 장치의 MAC 또는 IP Address를입력합니다. (BT : MAC Address, Netwrok : IP Address) import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; BXLConfigLoader bxlconfigloader = new BXLConfigLoader(this); bxlconfigloader.adden( SPP-R200III, BXLConfigLoader.DEVICE_CATEGORY_POS_PRINTER, BXLConfigLoader.PRODUCT_NAME_SPP_R200III, BXLConfigLoader.DEVICE_BUS_BLUETOOTH, 74:F0:7D:E4:11:AF ); catch(exception e) Rev. 2.02-28 -
6-1-5 removeen() 저장된설정정보를삭제합니다. boolean removeen(string logicalname) [Parameters] String logicalname : 장치의논리적이름 ( 별칭 ) 을입력합니다. [Return Values] 값설명 true 성공시리턴됩니다. false 실패시리턴됩니다. import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; for (Object en : bxlconfigloader.getentries()) JposEn jposen = (JposEn)en; String strlogicalname = jposen.getlogicalname(); bxlconfigloader.removeen(strlogicalname); catch(exception e) Rev. 2.02-29 -
6-1-6 savefile() adden, removeen 를통해변경된정보를저장합니다. void savefile() import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; for (Object en : bxlconfigloader.getentries()) JposEn jposen = (JposEn)en; String strlogicalname = jposen.getlogicalname(); bxlconfigloader.removeen(strlogicalname); bxlconfigloader.adden( SPP-R200III, BXLConfigLoader.DEVICE_CATEGORY_POS_PRINTER, BXLConfigLoader.PRODUCT_NAME_SPP_R200III, BXLConfigLoader.DEVICE_BUS_BLUETOOTH, 74:F0:7D:E4:11:AF ); bxlconfigloader.savefile(); catch(exception e) 주의 adden 함수를통해추가된장치는반드시 savefile 함수를통해저장해야합니다. Rev. 2.02-30 -
6-2 POSPrinter Class POS Printer 제어를위한 Class 입니다. 해당 Class 를사용하여프린터연결및해제와인쇄작업을수행합니다. 특정기능수행중에러발생시 JposException 을발생시킵니다. ( 5-1 JposException 참조 ) 6-2-1 open() 프린터클래스사용을시작하며메모리할당등의초기화작업이포함되어있습니다. Claim 이상의 Method 호출을위해서반드시선행되어야합니다. BXLConfigLoader Class 를통해저장되지않은장치는 open 되지않습니다. void open(string logicaldevicename) throws JposException [Parameters] String logicaldevicename : Open 하려는장치의이름을입력합니다. import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; import jpos.posprinter; import jpos.posprinterconst; POSPrinter posprinter = new POSPrinter(this); posprinter.open( SPP-R200III ); Rev. 2.02-31 -
6-2-2 claim() Device 정보에포함되어있는 Port 를실제로 Open 하기위해시도하며, 메모리할당초기화등의초기화작업이일부포함되어있습니다. Device 사용을활성화하기위해서반드시선행되어야합니다. void claim(int timeout) throws JposException [Parameters] int timeout : 이파라미터에서지정한시간동인 Port open 을시도합니다. import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; import jpos.posprinter; import jpos.posprinterconst; POSPrinter posprinter = new POSPrinter(this); posprinter.open( SPP-R200III ); posprinter.claim(3000); Rev. 2.02-32 -
6-2-3 setdeviceenabled() 장치사용여부를포함하고있습니다. DeviceEnabled 의값이비활성화되어있으면기능이용이불가능할수있습니다. void setdeviceenabled(boolean deviceenabled) throws JposException [Parameters] boolean deviceenabled : 장치활성화상태를입력합니다.. 값설명 true 활성화 false 비활성화 import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; import jpos.posprinter; import jpos.posprinterconst; POSPrinter posprinter = new POSPrinter(this); posprinter.open( SPP-R200III ); posprinter.claim(0); posprinter.setdeviceenabled(true); 6-2-4 release() Claim 된 Device 의 Port 사용을물리적으로종료합니다. 메모리해제등의작업이수행될수있습니다 void release() throws JposException import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; import jpos.posprinter; import jpos.posprinterconst; posprinter.release(); Rev. 2.02-33 -
6-2-5 close() Open 된 Device 의사용을종료합니다. 메모리해제등의작업이일부수행될수있습니다. void close() throws JposException import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; import jpos.posprinter; import jpos.posprinterconst; posprinter.close(); posprinter.setdeviceenabled(false); 6-2-6 checkhealth() 장치가정상적으로동작하는상태인지확인합니다. Open / Claim / DeviceEnabled 가정상적으로수행된상태일때사용가능합니다. void checkhealth(int level) throws JposException [Parameters] int level : 고정값 JposConst.JPOS_CH_INTERNAL import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; import jpos.posprinter; import jpos.posprinterconst; POSPrinter posprinter = new POSPrinter(this); posprinter.open( SPP-R200III ); posprinter.claim(0); posprinter.setdeviceenabled(true); posprinter.checkhealth(jposconst.jpos_ch_internal); Rev. 2.02-34 -
6-2-7 setasyncmode() 비동기모드사용여부를포함하고있습니다. 비동기모드가 true 일경우관련메소드가비동기모드로동작합니다. False 일경우관련메소드는동기모드로동작합니다. void setasyncmode(boolean asyncmode) throws JposException [Parameters] boolean asyncmode : 비동기모드사용여부를선택합니다. 값설명 true 비동기모드 false 동기모드 import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; import jpos.posprinter; import jpos.posprinterconst; POSPrinter posprinter = new POSPrinter(this); posprinter.open( SPP-R200III ); posprinter.claim(0); posprinter.setdeviceenabled(true); posprinter.setasyncmode(true); Rev. 2.02-35 -
6-2-8 setcharacterset() 프린터의 Character set 을설정합니다. void setcharacterset(int characterset) throws JposException [Parameters] int characterset : 프린터에설정할 Character set 을선택합니다. ( 5-12 Character Set 참조 ) import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; import jpos.posprinter; import jpos.posprinterconst; import com.bxl.bxlconst; POSPrinter posprinter = new POSPrinter(this); posprinter.open( SPP-R200III ); posprinter.claim(0); posprinter.setdeviceenabled(true); posprinter.setcharacterset(bxlconst.cs_437_usa_standard_europe); Rev. 2.02-36 -
6-2-9 setcharacterencoding() 프린터로전송할데이터의인코딩을설정합니다. void setcharacterencoding(int characterencoding) throws JposException [Parameters] int characterencoding : 데이터인코딩타입을선택합니다. 상수명 값 설명 CE_ASCII 0 ASCII(default) CE_UTF8 1 UTF-8 import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; import jpos.posprinter; import jpos.posprinterconst; import com.bxl.bxlconst; POSPrinter posprinter = new POSPrinter(this); posprinter.open( SPP-R200III ); posprinter.claim(0); posprinter.setdeviceenabled(true); posprinter.setcharacterencoding(bxlconst.ce_ascii); Rev. 2.02-37 -
6-2-10 cutpaper() Auto Cutter 가내장된모델의경우종이를절단합니다. void cutpaper(int percentage) throws JposException [Parameters] int percentage : Full cut/partial cut 을선택합니다. 커터가달린모델에한해동작합니다. 값설명 100 Full cut 90 Partial cut import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; import jpos.posprinter; import jpos.posprinterconst; import com.bxl.bxlconst; POSPrinter posprinter = new POSPrinter(this); posprinter.open( SPP-R200III ); posprinter.claim(0); posprinter.setdeviceenabled(true); posprinter.cutpaper(100); Rev. 2.02-38 -
6-2-11 printbarcode() 바코드를인쇄합니다. void printbarcode(int station, String data, int symbology, int height, int width, int alignment, int textposition) throws JposException [Parameters] int station : 고정값 PTR_S_RECEIPT String data : 바코드에포함할 Data, 바코드타입별허용되는 Data 가다를수있습니다. int symbology : Barcode 종류를선택합니다.( 5-6 바코드타입 참조 ) int height : Barcode 의높이를지정합니다. int width : Barcode 의너비를지정합니다. int alignment : 바코드정렬을선택합니다. ( 5-5 Alignment 참조 ) int textposition : 바코드와함께출력될 Text 의 Postion 을결정합니다. ( 5-7 바코드텍스트위치 참조 ) import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; import jpos.posprinter; import jpos.posprinterconst; import com.bxl.bxlconst; POSPrinter posprinter = new POSPrinter(this); posprinter.open( SPP-R200III ); posprinter.claim(0); posprinter.setdeviceenabled(true); posprinter.printbarcode(posprinterconst.ptr_s_receipt, 123456789, POSPrinterConst.PTR_BCS_QRCODE, 8, 8, POSPrinterConst.PTR_BC_CENTER, POSPrinterConst.PTR_BC_TEXT_BELOW); Rev. 2.02-39 -
6-2-12 printbitmap() 이미지를인쇄합니다.( 파일인쇄 ) void printbitmap(int station, String filename, int width, int alignment) throws JposException [Parameters] int station : 이미지인쇄옵션을설정합니다.( 총 4바이트로구성 ) Index 설명첫번째바이트고정값 : PTR_S_RECEIPT 두번째바이트밝기 : 0 ~ 100 세번째바이트압축알고리즘 (RLE) 사용여부 (0x01 : RLE) 네번째바이트 Reserved(0x00) String filename : 이미지파일의경로를지정합니다. int width : 이미지너비를지정합니다. int alignment : 이미지정렬을선택합니다. ( 5-5 Alignment 참조 ) import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; import jpos.posprinter; import jpos.posprinterconst; import com.bxl.bxlconst; POSPrinter posprinter = new POSPrinter(this); posprinter.open( SPP-R200III ); posprinter.claim(0); posprinter.setdeviceenabled(true); ByteBuffer buffer = ByteBuffer.allocate(4); buffer.put((byte) POSPrinterConst.PTR_S_RECEIPT); buffer.put((byte) 80); // brightness buffer.put((byte) 0x01); // compress buffer.put((byte) 0x00); posprinter.printbitmap(buffer.getint(0), imagepath, posprinter.getreclinewidth(), POSPrinterConst.PTR_BM_LEFT); Rev. 2.02-40 -
6-2-13 printbitmap() 이미지를인쇄합니다.(Bitmap 데이터 ) void printbitmap(int station, Bitmap bitmap, int width, int alignment) throws JposException [Parameters] int station : 이미지인쇄옵션을설정합니다.( 총 4바이트로구성 ) Index 설명첫번째바이트고정값 : PTR_S_RECEIPT 두번째바이트밝기 : 0 ~ 100 세번째바이트압축알고리즘 (RLE) 사용여부 (0x01 : RLE) 네번째바이트 Reserved(0x00) Bitmap bitmap : 비트맵형식의이미지데이터를입력합니다. int width : 이미지너비를지정합니다. int alignment : 이미지정렬을선택합니다. ( 5-5 Alignment 참조 ) import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; import jpos.posprinter; import jpos.posprinterconst; import com.bxl.bxlconst; POSPrinter posprinter = new POSPrinter(this); posprinter.open( SPP-R200III ); posprinter.claim(0); posprinter.setdeviceenabled(true); ByteBuffer buffer = ByteBuffer.allocate(4); buffer.put((byte) POSPrinterConst.PTR_S_RECEIPT); buffer.put((byte) 80); // brightness buffer.put((byte) 0x01); // compress buffer.put((byte) 0x00); posprinter.printbitmap(buffer.getint(0), BitmapData, posprinter.getreclinewidth(), POSPrinterConst.PTR_BM_LEFT); Rev. 2.02-41 -
6-2-14 printnormal() 텍스트를인쇄합니다. void printnormal(int station, String data) throws JposException [Parameters] int station : 고정값 PTR_S_RECEIPT String data : 출력할 Data 를지정합니다. 출력가능한문자와 escape sequences, carriage returns, line feeds Data 가허용됩니다. import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; import jpos.posprinter; import jpos.posprinterconst; import com.bxl.bxlconst; POSPrinter posprinter = new POSPrinter(this); posprinter.open( SPP-R200III ); posprinter.claim(0); posprinter.setdeviceenabled(true); posprinter.printnormal(posprinterconst.ptr_s_receipt, Print Data\n ); Rev. 2.02-42 -
6-2-15 printpdf() PDF 파일을인쇄합니다. void printpdf(int station, String filename, int width, int alignment, int page, int brightness) throws JposException [Parameters] int station : 고정값 PTR_S_RECEIPT String filename : PDF 파일의경로를지정합니다. int width : PDF 너비를지정합니다. int alignment : 이미지정렬을선택합니다. ( 5-5 Alignment 참조 ) int page : 인쇄할 PDF 페이지번호를지정합니다. int brightness : 밝기값을지정합니다. (0 ~ 100) import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; import jpos.posprinter; import jpos.posprinterconst; import com.bxl.bxlconst; POSPrinter posprinter = new POSPrinter(this); posprinter.open( SPP-R200III ); posprinter.claim(0); posprinter.setdeviceenabled(true); posprinter.printpdf(posprinterconst.ptr_s_receipt, pdffilepath, posprinter.getreclinewidth(), POSPrinterConst.PTR_PDF_CENTER, 1, 80); Rev. 2.02-43 -
6-2-16 printpdf() PDF 파일을인쇄합니다. void printpdf(int station, String filename, int width, int alignment, int startpage, int endpage, int brightness) throws JposException [Parameters] int station : 고정값 PTR_S_RECEIPT String filename : PDF 파일의경로를지정합니다. int width : PDF 너비를지정합니다. int alignment : 이미지정렬을선택합니다. ( 5-5 Alignment 참조 ) int startpage : 인쇄를시작할페이지번호를지정합니다. int endpage : 인쇄를끝낼페이지번호를지정합니다. int brightness : 밝기값을지정합니다. (0 ~ 100) import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; import jpos.posprinter; import jpos.posprinterconst; import com.bxl.bxlconst; POSPrinter posprinter = new POSPrinter(this); posprinter.open( SPP-R200III ); posprinter.claim(0); posprinter.setdeviceenabled(true); posprinter.printpdf(posprinterconst.ptr_s_receipt, pdffilepath, posprinter.getreclinewidth(), POSPrinterConst.PTR_PDF_CENTER, 1, 3, 80); Rev. 2.02-44 -
6-2-17 setpagemodeprintarea() 페이지모드영역을지정합니다. void setpagemodeprintarea(string area) throws JposException [Parameters] String area : 인쇄영역을지정합니다. 영역의 x 좌표, 영역의 y 좌표, 영역의가로, 영역의세로 ex) 0, 0, 576, 1600 import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; import jpos.posprinter; import jpos.posprinterconst; import com.bxl.bxlconst; POSPrinter posprinter = new POSPrinter(this); posprinter.open( SPP-R200III ); posprinter.claim(0); posprinter.setdeviceenabled(true); posprinter.setpagemodeprintarea( 0, 0, 576, 1600 ); Rev. 2.02-45 -
6-2-18 setpagemodeprintdirection() 페이지모드인쇄방향을지정합니다. void setpagemodeprintdirection(int direction) throws JposException [Parameters] int direction : 인쇄방향을지정합니다.( 5-9 페이지모드인쇄방향 참조 ) import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; import jpos.posprinter; import jpos.posprinterconst; import com.bxl.bxlconst; POSPrinter posprinter = new POSPrinter(this); posprinter.open( SPP-R200III ); posprinter.claim(0); posprinter.setdeviceenabled(true); posprinter.setpagemodeprintarea( 0, 0, 576, 1600 ); posprinter.setpagemodeprintdirection(posprinterconst.ptr_pd_left_to_right); Rev. 2.02-46 -
6-2-19 pagemodeprint() 프린터를페이지모드로설정합니다. void pagemodeprint(int control) throws JposException [Parameters] int control : 페이지모드를지정합니다. 상수명 값 설명 PTR_PM_PAGE_MODE 1 페이지모드활성화 PTR_PM_NORMAL 2 일반모드로변경되며페이지모드버퍼에저장된데이터가인쇄됩니다. import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; import jpos.posprinter; import jpos.posprinterconst; import com.bxl.bxlconst; POSPrinter posprinter = new POSPrinter(this); posprinter.open( SPP-R200III ); posprinter.claim(0); posprinter.setdeviceenabled(true); posprinter.setpagemodeprintarea( 0, 0, 576, 1600 ); posprinter.setpagemodeprintdirection(posprinterconst.ptr_pd_left_to_right); posprinter.setpagemodeprint(posprinterconst.ptr_pm_page_mode); Rev. 2.02-47 -
6-2-20 setpagemodehorizontalposition() 인쇄시작위치 ( 가로 ) 를지정합니다. void setpagemodehorizontalposition(int position) throws JposException [Parameters] int position : 인쇄시작위치 ( 가로 ) import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; import jpos.posprinter; import jpos.posprinterconst; import com.bxl.bxlconst; POSPrinter posprinter = new POSPrinter(this); posprinter.open( SPP-R200III ); posprinter.claim(0); posprinter.setdeviceenabled(true); ByteBuffer buffer = ByteBuffer.allocate(4); buffer.put((byte) POSPrinterConst.PTR_S_RECEIPT); buffer.put((byte) 80); // brightness buffer.put((byte) 0x01); // compress buffer.put((byte) 0x00); // 인쇄영역지정 posprinter.setpagemodeprintarea( 0, 0, 576, 1600 ); // 인쇄방향설정 posprinter.setpagemodeprintdirection(posprinterconst.ptr_pd_left_to_right); // 프린터페이지모드로변환 posprinter.setpagemodeprint(posprinterconst.ptr_pm_page_mode); // 가로 / 세로인쇄위치지정 posprinter.setpagemodehorizontalposition(0); posprinter.setpagemodeverticalposition(0); // 인쇄할데이터전송 ( 이미지 ) posprinter.printbitmap(buffer.getint(0), imagepath, 384, POSPrinterConst.PTR_BM_LEFT); // 가로 / 세로인쇄위치지정 posprinter.setpagemodehorizontalposition(100); posprinter.setpagemodeverticalposition(100); // 인쇄할데이터전송 ( 텍스트 ) posprinter.printnormar(posprinterconst.ptr_s_receipt, Print Data\n ); // 인쇄시작 posprinter.setpagemodeprint(posprinterconst.ptr_pm_page_normal); Rev. 2.02-48 -
6-2-21 setpagemodeverticalposition() 인쇄시작위치 ( 세로 ) 를지정합니다. void setpagemodeverticalposition(int position) throws JposException [Parameters] int position : 인쇄시작위치 ( 세로 ) import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; import jpos.posprinter; import jpos.posprinterconst; import com.bxl.bxlconst; POSPrinter posprinter = new POSPrinter(this); posprinter.open( SPP-R200III ); posprinter.claim(0); posprinter.setdeviceenabled(true); ByteBuffer buffer = ByteBuffer.allocate(4); buffer.put((byte) POSPrinterConst.PTR_S_RECEIPT); buffer.put((byte) 80); // brightness buffer.put((byte) 0x01); // compress buffer.put((byte) 0x00); // 인쇄영역지정 posprinter.setpagemodeprintarea( 0, 0, 576, 1600 ); // 인쇄방향설정 posprinter.setpagemodeprintdirection(posprinterconst.ptr_pd_left_to_right); // 프린터페이지모드로변환 posprinter.setpagemodeprint(posprinterconst.ptr_pm_page_mode); // 가로 / 세로인쇄위치지정 posprinter.setpagemodehorizontalposition(0); posprinter.setpagemodeverticalposition(0); // 인쇄할데이터전송 ( 이미지 ) posprinter.printbitmap(buffer.getint(0), imagepath, 384, POSPrinterConst.PTR_BM_LEFT); // 가로 / 세로인쇄위치지정 posprinter.setpagemodehorizontalposition(100); posprinter.setpagemodeverticalposition(100); // 인쇄할데이터전송 ( 텍스트 ) posprinter.printnormar(posprinterconst.ptr_s_receipt, Print Data\n ); // 인쇄시작 posprinter.setpagemodeprint(posprinterconst.ptr_pm_page_normal); Rev. 2.02-49 -
6-2-22 transactionprint() Transaction Mode 를사용하여인쇄합니다. public void transactionprint(int station, int control) throws JposException [Parameters] int station : 고정값 PTR_S_RECEIPT int control : Transaction Mode( 5-4 Transaction Print 참조 ) import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; import jpos.posprinter; import jpos.posprinterconst; import com.bxl.bxlconst; POSPrinter posprinter = new POSPrinter(this); posprinter.open( SPP-R200III ); posprinter.claim(0); posprinter.setdeviceenabled(true); // Transaction mode 시작 posprinter.transactionprint(posprinterconst.ptr_tp_transaction); // 인쇄할데이터전송 ( 이미지 ) posprinter.printbitmap(buffer.getint(0), imagepath, 384, POSPrinterConst.PTR_BM_LEFT); // 인쇄할데이터전송 ( 텍스트 ) posprinter.printnormar(posprinterconst.ptr_s_receipt, Print Data\n ); // Transaction mode 종료 ( 인쇄시작 ) posprinter.transactionprint(posprinterconst.ptr_tp_normal); Rev. 2.02-50 -
6-2-23 displaystring() BCD-3000 에텍스트를출력합니다. 단, BCD-3000 은 SRP-Q300 DK port 에연결되어있어야합니다. public void displaystring(string data) throws JposException [Parameters] String data : BCD-3000 에출력할텍스트데이터 import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; import jpos.posprinter; import jpos.posprinterconst; import com.bxl.bxlconst; POSPrinter posprinter = new POSPrinter(this); posprinter.open( SRP-Q300 ); posprinter.claim(0); posprinter.setdeviceenabled(true); posprinter.displaystring( BIXOLON Customer Display 3000 ); Rev. 2.02-51 -
6-2-24 cleanscreen() BCD-3000 화면을클리어합니다. 단, BCD-3000 은 SRP-Q300 DK port 에연결되어있어야합니다. public void cleanscreen() throws JposException import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; import jpos.posprinter; import jpos.posprinterconst; import com.bxl.bxlconst; POSPrinter posprinter = new POSPrinter(this); posprinter.open( SRP-Q300 ); posprinter.claim(0); posprinter.setdeviceenabled(true); posprinter.displaystring( BIXOLON Customer Display 3000 ); posprinter.cleanscreen(); Rev. 2.02-52 -
6-2-25 storeimagefile() BCD-3000 이미지버퍼에이미지데이터를저장합니다. 단, BCD-3000 은 SRP-Q300 DK port 에연결되어있어야합니다. public void storeimagefile(string filename, int width, int height, int imagenumber) throws JposException [Parameters] String filename : 이미지파일의경로를지정합니다. int width : 이미지너비를지정합니다.(1 ~ 160) int height : 이미지높이를지정합니다.(1 ~ 32) int imagenumber : 저장할이미지데이터번호를지정합니다.(1 ~ 5) import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; import jpos.posprinter; import jpos.posprinterconst; import com.bxl.bxlconst; POSPrinter posprinter = new POSPrinter(this); posprinter.open( SRP-Q300 ); posprinter.claim(0); posprinter.setdeviceenabled(true); posprinter.storeimagefile(imagepath, 160, 32, 1); Rev. 2.02-53 -
6-2-26 displayimage() BCD-3000 이미지버퍼에저장된이미지를출력합니다. 단, BCD-3000 은 SRP-Q300 DK port 에연결되어있어야합니다. public void displayimage(int imagenumber, int xpos, int ypos) throws JposException [Parameters] int imagenumber : 출력할이미지데이터번호를지정합니다.(1 ~ 5) int xpos : 이미지를출력할 X 좌표를입력합니다.(0 ~ 159) int ypos : 이미지를출력할 Y 좌표를입력합니다.(0 ~ 31) 이미지가출력할영역을넘어갈경우이미지는 Display 되지않습니다. import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; import jpos.posprinter; import jpos.posprinterconst; import com.bxl.bxlconst; POSPrinter posprinter = new POSPrinter(this); posprinter.open( SRP-Q300 ); posprinter.claim(0); posprinter.setdeviceenabled(true); posprinter.storeimagefile(imagepath, 160, 32, 1); posprinter.displayimage(1, 0, 0); Rev. 2.02-54 -
6-2-27 clearimage() BCD-3000 이미지버퍼에저장된이미지를삭제합니다. 단, BCD-3000 은 SRP-Q300 DK port 에연결되어있어야합니다. public void clearimage(boolean isall, int imagenumber) throws JposException [Parameters] boolean isall : 이미지버퍼클리어모드를선택합니다. 값설명 true 이미지버퍼의모든이미지를삭제합니다. 지정된번호의이미지만삭제합니다. imagenumber에삭제할 false 이미지번호를입력해야합니다. int imagenumber : 삭제할이미지데이터번호를지정합니다. (1 ~ 5) import com.bxl.config.editor.bxlconfigloader; import jpos.config.jposen; import jpos.posprinter; import jpos.posprinterconst; import com.bxl.bxlconst; POSPrinter posprinter = new POSPrinter(this); posprinter.open( SRP-Q300 ); posprinter.claim(0); posprinter.setdeviceenabled(true); posprinter.storeimagefile(imagepath, 160, 32, 1); posprinter.displayimage(1, 0, 0); posprinter.clearimage(false, 1); Rev. 2.02-55 -
6-3 MSR Class 프린터의 MSR(Magnetic Stripe Reader) 제어를위한 Class 입니다. 해당 Class 를사용하여 MSR 로부터 Card Track 정보를얻어올수있습니다. 특정기능수행중에러발생시 JposException 을발생시킵니다. ( 5-1 JposException 참조 ) 6-3-1 open() MSR 클래스사용을시작하며메모리할당등의초기화작업이포함되어있습니다. Claim 이상의 Method 호출을위해서반드시선행되어야합니다. BXLConfigLoader Class 를통해저장되지않은장치는 open 되지않습니다. void open(string logicaldevicename) throws JposException [Parameters] String logicaldevicename : Open 하려는장치이름 import jpos.jposconst; import jpos.jposexception; import jpos.msr; import jpos.msrconst; import jpos.events.dataevent; import jpos.events.datalistener; MSR msr = new MSR(); msr.open( SPP-R200III ); Rev. 2.02-56 -
6-3-2 claim() Device 정보에포함되어있는 Port 를실제로 Open 하기위해시도하며, 메모리할당초기화등의초기화작업이일부포함되어있습니다. Device 사용을활성화하기위해서반드시선행되어야합니다. void claim(int timeout) throws JposException [Parameters] int timeout : 이파라미터에서지정한시간동인 Port open 을시도합니다. import jpos.jposconst; import jpos.jposexception; import jpos.msr; import jpos.msrconst; import jpos.events.dataevent; import jpos.events.datalistener; MSR msr = new MSR(); msr.open( SPP-R200III ); msr.claim(3000); Rev. 2.02-57 -
6-3-3 setdeviceenabled() 장치사용여부를포함하고있습니다. DeviceEnabled 의값이비활성화되어있으면기능이용이불가능할수있습니다. void setdeviceenabled(boolean deviceenabled) throws JposException [Parameters] boolean deviceenabled : 장치활성화상태를입력합니다.. 값설명 true 활성화 false 비활성화 import jpos.jposconst; import jpos.jposexception; import jpos.msr; import jpos.msrconst; import jpos.events.dataevent; import jpos.events.datalistener; MSR msr = new MSR(); msr.open( SPP-R200III ); msr.claim(3000); msr.setdeviceenabled(true); Rev. 2.02-58 -
6-3-4 release() Claim 된 Device 의 Port 사용을물리적으로종료합니다. 메모리해제등의작업이수행될수있습니다 void release() throws JposException import jpos.jposconst; import jpos.jposexception; import jpos.msr; import jpos.msrconst; import jpos.events.dataevent; import jpos.events.datalistener; msr.release(); 6-3-5 close() Open 된 Device 의사용을종료합니다. 메모리해제등의작업이일부수행될수있습니다. void close() throws JposException import jpos.jposconst; import jpos.jposexception; import jpos.msr; import jpos.msrconst; import jpos.events.dataevent; import jpos.events.datalistener; msr.close(); msr.setdeviceenabled(false); Rev. 2.02-59 -
6-3-6 setautodisable() MSR 리딩후자동으로 MSR 장치를비활성화합니다. AutoDisable 가 true 일경우 MSR 데이터수신후 DeviceEnabled 를 false 로변경합니다. void setautodisable(boolean autodisable) throws JposException [Parameters] boolean autodisable : Auto Disable 여부를지정합니다. 값설명 true 활성화 false 비활성화 import jpos.jposconst; import jpos.jposexception; import jpos.msr; import jpos.msrconst; import jpos.events.dataevent; import jpos.events.datalistener; MSR msr = new MSR(); msr.open( SPP-R200III ); msr.claim(3000); msr.setdeviceenabled(true); msr.setautodisable(true); // msr.setautodisable(false); Rev. 2.02-60 -
6-3-7 setdataeventenabled() MSR 리딩후 Track 정보를 Data Event 를통해수신할지여부를지정합니다. void setdataeventenabled(boolean dataeventenabled) throws JposException [Parameters] boolean dataeventenabled : Data Event 사용여부를지정합니다. 값설명 true Event 사용 ( 5-2.4 Data Event 참조 ) false Event 미사용 import jpos.jposconst; import jpos.jposexception; import jpos.msr; import jpos.msrconst; import jpos.events.dataevent; import jpos.events.datalistener; MSR msr = new MSR(); msr.open( SPP-R200III ); msr.claim(3000); msr.setdeviceenabled(true); msr.adddatalistener(this); msr.setdataeventenabled(true); Rev. 2.02-61 -
6-3-8 setdataencryptionalgorithm() MSR Track 데이터의암호화여부를지정합니다. void setdataencryptionalgorithm(int encryptalgorithm) throws JposException [Parameters] int encryptalgorithm : Track 암호화사용여부를지정합니다.( 5-10 MSR 암호화 참조 ) import jpos.jposconst; import jpos.jposexception; import jpos.msr; import jpos.msrconst; import jpos.events.dataevent; import jpos.events.datalistener; MSR msr = new MSR(); msr.open( SPP-R200III ); msr.claim(3000); msr.setdeviceenabled(true); msr. setdataencryptionalgorithm(msrconst.msr_de_none); Rev. 2.02-62 -
6-3-9 gettrack1data() 가장최근에읽은 MSR Card 의 Track1 Data 를가져옵니다. byte[] gettrack1data() throws JposException [Return Values] MSR Card 의 Track1 Data import jpos.jposconst; import jpos.jposexception; import jpos.msr; import jpos.msrconst; import jpos.events.dataevent; import jpos.events.datalistener; MSR msr = new MSR(); msr.open( SPP-R200III ); msr.claim(3000); msr.setdeviceenabled(true); byte[] track1 = msr. gettrack1data(); Rev. 2.02-63 -
6-3-10 gettrack2data() 가장최근에읽은 MSR Card 의 Track2 Data 를가져옵니다. byte[] gettrack2data() throws JposException [Return Values] MSR Card 의 Track2 Data import jpos.jposconst; import jpos.jposexception; import jpos.msr; import jpos.msrconst; import jpos.events.dataevent; import jpos.events.datalistener; MSR msr = new MSR(); msr.open( SPP-R200III ); msr.claim(3000); msr.setdeviceenabled(true); byte[] track2 = msr. gettrack2data(); Rev. 2.02-64 -
6-3-11 gettrack1data() 가장최근에읽은 MSR Card 의 Track3 Data 를가져옵니다. byte[] gettrack3data() throws JposException [Return Values] MSR Card 의 Track3 Data import jpos.jposconst; import jpos.jposexception; import jpos.msr; import jpos.msrconst; import jpos.events.dataevent; import jpos.events.datalistener; MSR msr = new MSR(); msr.open( SPP-R200III ); msr.claim(3000); msr.setdeviceenabled(true); byte[] track3 = msr. gettrack3data(); Rev. 2.02-65 -
6-4 SmartCardRW Class 프린터의 SCR(Smart Card Reader) 제어를위한 Class 입니다. 특정기능수행중에러발생시 JposException 을발생시킵니다. ( 5-1 JposException 참조 ) 6-4-1 open() SmartCardRW 클래스사용을시작하며메모리할당등의초기화작업이포함되어있습니다. Claim 이상의 Method 호출을위해서반드시선행되어야합니다. BXLConfigLoader Class 를통해저장되지않은장치는 open 되지않습니다. void open(string logicaldevicename) throws JposException [Parameters] String logicaldevicename : Open 하려는장치이름 import jpos.jposconst; import jpos.jposexception; import jpos.smartcardrw; import jpos.smartcardrwconst; SmartCardRW smartcardrw = new SmartCardRW(); smartcardrw.open( SPP-R200III ); Rev. 2.02-66 -
6-4-2 claim() Device 정보에포함되어있는 Port 를실제로 Open 하기위해시도하며, 메모리할당초기화등의초기화작업이일부포함되어있습니다. Device 사용을활성화하기위해서반드시선행되어야합니다. void claim(int timeout) throws JposException [Parameters] int timeout : 이파라미터에서지정한시간동인 Port open 을시도합니다. import jpos.jposconst; import jpos.jposexception; import jpos.smartcardrw; import jpos.smartcardrwconst; SmartCardRW smartcardrw = new SmartCardRW(); smartcardrw.open( SPP-R200III ); smartcardrw.claim(3000); Rev. 2.02-67 -
6-4-3 setdeviceenabled() 장치사용여부를포함하고있습니다. DeviceEnabled 의값이비활성화되어있으면기능이용이불가능할수있습니다. void setdeviceenabled(boolean deviceenabled) throws JposException [Parameters] boolean deviceenabled : 장치활성화상태를입력합니다.. 값설명 true 활성화 false 비활성화 import jpos.jposconst; import jpos.jposexception; import jpos.smartcardrw; import jpos.smartcardrwconst; SmartCardRW smartcardrw = new SmartCardRW(); smartcardrw.open( SPP-R200III ); smartcardrw.claim(3000); SmartCardRW.setDeviceEnabled(true); 6-4-4 release() Claim 된 Device 의 Port 사용을물리적으로종료합니다. 메모리해제등의작업이수행될수있습니다 void release() throws JposException import jpos.jposconst; import jpos.jposexception; import jpos.smartcardrw; import jpos.smartcardrwconst; smartcardrw.release(); Rev. 2.02-68 -
6-4-5 close() Open 된 Device 의사용을종료합니다. 메모리해제등의작업이일부수행될수있습니다. void close() throws JposException import jpos.jposconst; import jpos.jposexception; import jpos.smartcardrw; import jpos.smartcardrwconst; smartcardrw.close(); smartcardrw.setdeviceenabled(false); Rev. 2.02-69 -
6-4-6 setscslot() 통신을위한 Card slot 을선택합니다. void setscslot() throws JposException [Parameters] int scslot : 카드슬롯을선택합니다. 값설명 0x1000 Smart Card 0x0100 SAM1 0x0010 SAM2 import jpos.jposconst; import jpos.jposexception; import jpos.smartcardrw; import jpos.smartcardrwconst; SmartCardRW smartcardrw = new SmartCardRW(); smartcardrw.open( SPP-R200III ); smartcardrw.claim(3000); SmartCardRW.setDeviceEnabled(true); smartcardrw.setscslot(0x01 << (Integer.SIZE - 1)); // Smart Card smartcardrw.setscslot(0x01 << (Integer.SIZE - 2)); // SAM1 smartcardrw.setscslot(0x01 << (Integer.SIZE - 3)); // SAM2 Rev. 2.02-70 -
6-4-7 setisoemvmode() ISO/EMV 모드를선택합니다. void setisoemvmode(int isoemvmode) throws JposException [Parameters] int isoemvmode : 모드를선택합니다.( 5-11 SCR 모드 참조 ) import jpos.jposconst; import jpos.jposexception; import jpos.smartcardrw; import jpos.smartcardrwconst; SmartCardRW smartcardrw = new SmartCardRW(); smartcardrw.open( SPP-R200III ); smartcardrw.claim(3000); SmartCardRW.setDeviceEnabled(true); smartcardrw.setisoemvmode(smartcardrwconst.sc_cmode_emv); // EMV Mode smartcardrw.setisoemvmode(smartcardrwconst.sc_cmode_iso); // ISO Mode Rev. 2.02-71 -
6-4-8 readdata() Smart Card chip 에데이터를 R/W 합니다. void readdata(int action, int[] count, String[] data) throws JposException [Parameters] int action : 고정값 SmartCardRWConst.SC_READ_DATA int[] count : 응답데이터사이즈 String[] data : R/W 버퍼 import jpos.jposconst; import jpos.jposexception; import jpos.smartcardrw; import jpos.smartcardrwconst; SmartCardRW smartcardrw = new SmartCardRW(); smartcardrw.open( SPP-R200III ); smartcardrw.claim(3000); SmartCardRW.setDeviceEnabled(true); String[] data = new String[] new String(new byte[] 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40) ; int[] count = new int[1]; smartcardrw. readdata(smartcardrwconst.sc_read_data, count, data); int rspsize = count[0]; byte[] rspdata = data[0].getbytes(); Rev. 2.02-72 -