diff --git a/Readme_En.txt b/Readme_En.txt new file mode 100644 index 0000000..f74414f --- /dev/null +++ b/Readme_En.txt @@ -0,0 +1,122 @@ +************************************************************ + Star PassPRNT Android SDK Ver 2.3.0 + Readme_En.txt Star Micronics Co., Ltd. +************************************************************ + + 1. Overview + 2. Contents + 3. Scope + 4. Copyright + 5. Release History + +============= + 1. Overview +============= + This package contains SDK for PassPRNT. + "PassPRNT" is an application intervening outer applications (hereinafter + called "Coordinating App") and Star Device (hereinafter called "Device"). + This App transfers to the printer the print data converted from all Coordinating + App information including receipt design, paper width and other related data. + Therefore the Coordinating App needs no designing or development to establish + communication with the printer. + Similarly printer status and print result are monitored as well so that + Coordinating App is not required on such control. + + Receipt design put out of this system is supported by HTML/PDF layout, so there is + no need to understand the device unique command specifications. + The other transferred data is also distributed as a part of query based on + the standard URL specifications. + + e.g.: + starpassprnt://v1/print/nopreview?html=&size=3&drawer=on&back= + + Please refer to document including this package for details. + +============= + 2. Contents +============= + + PassPRNT_Android_SDK_Ver2.3.0 + | + | Readme_En.txt // Release Note(English) + | Readme_Jp.txt // Release Note(Japanese) + | SoftwareLicenseAgreement.pdf // Software License Agreement(English) + | SoftwareLicenseAgreement_jp.pdf // Software License Agreement(Japanese) + | UsersManual_Android.url // Shortcut to User Manual + | + +- Samples // Android Studio project file for sample program + + +================= + 3. Scope +================= + [OS] + Android OS 5.0 - 12 + + [Software] + PassPRNT Ver2.5.0 + + [Printer Model] + SM-L200 (Ver 1.1 or later - StarPRNT mode) + SM-S210i *1 (Ver 3.0 or later - StarPRNT mode) + (Ver 2.5 or later - ESC/POS mode) + SM-S220i *2 (Ver 3.0 or later - StarPRNT mode) + (Ver 2.1 or later - ESC/POS mode) + SM-S230i *2 (Ver 1.0 or later - StarPRNT mode) + (Ver 1.0 or later - ESC/POS mode) + SM-L300 (Ver 1.0 or later - StarPRNT mode) + SM-T300i/T300DB (Ver 3.0 or later - StarPRNT mode) + (Ver 2.5 or later - ESC/POS mode) + SM-T400i (Ver 3.0 or later - StarPRNT mode) + (Ver 2.5 or later - ESC/POS mode) + TSP650II (Ver 2.1 or later) + TSP700II (Ver 5.1 or later) + TSP800II (Ver 2.1 or later) + TSP100IIIBI (Ver 1.0 or later) + TSP100IIIW (Ver 1.4 or later) + TSP100IIILAN (Ver 1.3 or later) + TSP100IIIU (Ver 1.0 or later) + TSP100IV (Ver 1.0 or later) + FVP10 (Ver 1.3 or later) + BSC10 *2 (Ver 1.0 or later) + mPOP (Ver 1.0.1 or later) + mC-Print2 (Ver 1.0 or later) + mC-Print3 (Ver 1.0 or later) + + *1-JP model only + *2-US EU model only + + [Interface] + Bluetooth: TSP series (IFBD-HB03/HB04 Ver 1.0.0 or later) + : Portable printers + : mPOP, mC-Print2, mC-Print3 + Ethernet : TSP series, FVP10, BSC10 (IFBD-HE05/HE06 Ver 1.0.1 or later) + mC-Print2, mC-Print3 + USB : TSP series, FVP10, BSC10 (IFBD-HU07/HU08) + mPOP, mC-Print2, mC-Print3 + +============== + 4. Copyright +============== + Copyright 2016 - 2021 Star Micronics Co., Ltd. All rights reserved. + +==================== + 5. Release History +==================== + + Ver 2.3.0 + 2021/10/29 : Added TSP100IV support. + Added Buzzer (BU01) and Melody Speaker (mC-Sound) support. + + Ver 2.2 + 2020/01/23 : Added Web Download Print function ('Url' query). + + Ver 2.1 + 2018/07/02 : Add printer models (mC-Print2/mC-Print3) + Add queries (drawerpulse/cut) + Change specification of Black mark. + + Ver 2.0 + 2017/09/29 : Add printer models (SM-L300/TSP100III U) + Add printer settings (Drawer pulse/Cut type) + Change specification of Black mark and PDF function diff --git a/Readme_Jp.txt b/Readme_Jp.txt new file mode 100644 index 0000000..ec08f37 --- /dev/null +++ b/Readme_Jp.txt @@ -0,0 +1,121 @@ +************************************************************ + Star PassPRNT Android SDK Ver 2.3.0 + Readme_Jp.txt スター精密(株) +************************************************************ + + 1. 概要 + 2. 内容 + 3. 適用 + 4. 著作権 + 5. 変更履歴 + +========== + 1. 概要 +========== + 本パッケージは、AndroidのStarPassPRNT専用SDKです。 + “PassPRNT”とは、外部アプリケーション(以降、”連携アプリ”とする)と + スターデバイス(以降、”デバイス”とする)の間に配置するアプリケーションです。 + このアプリケーションは、連携アプリからレシートのデザイン、用紙幅、その他に + 関連する情報を受け取ると印字データに変換して、プリンタに送信を行います。 + よって、連携アプリはプリンタとの通信に関わる部分の設計-開発の必要がありません。 + またプリンタステータスの監視や印刷成否の判定も行うため、連携アプリは + それらの実施も不要となります。 + + またレシートデザインは、HTML/PDFレイアウトに対応しているため、 + デバイス独自のコマンド仕様を理解する必要はありません。 + その他の受け渡しデータも、一般的なURL仕様に基づいてクエリの一部として + 組み込んで受け渡す仕様となっています。 + + 例: + starpassprnt://v1/print/nopreview?html=&size=3&drawer=on&back=<連携アプリ> + + 詳細は別紙ドキュメントファイルを参照ください。 + +========== + 2. 内容 +========== + PassPRNT_Android_SDK_Ver2.3.0 + | + | Readme_En.txt // リリースノート(英語) + | Readme_Jp.txt // リリースノート(日本語) + | SoftwareLicenseAgreement.pdf // ソフトウエア使用許諾書(英語) + | SoftwareLicenseAgreement_jp.pdf // ソフトウエア使用許諾書(日本語) + | UsersManual_Android.url // User Manualへのショートカット + | + +- Samples // Android Studio用サンプルプログラム + +============= + 3. 適用 +============= + ■ 対象OS + Android OS 5.0 - 12 + + ■ 対象ソフトウェア + PassPRNT Ver 2.5.0 + + ■ 対象プリンタモデル + ◇ プリンタモデル (F/W ver) + SM-L200 (Ver 1.1以降 - StarPRNT mode) + SM-S210i *1 (Ver 3.0以降 - StarPRNT mode) + (Ver 2.5以降 - ESC/POS mode) + SM-S220i *2 (Ver 3.0以降 - StarPRNT mode) + (Ver 2.1以降 - ESC/POS mode) + SM-S230i *2 (Ver 1.0以降 - StarPRNT mode) + (Ver 1.0以降 - ESC/POS mode) + SM-L300 (Ver 1.0以降 - StarPRNT mode) + SM-T300i/T300DB (Ver 3.0以降 - StarPRNT mode) + (Ver 2.5以降 - ESC/POS mode) + SM-T400i (Ver 3.0以降 - StarPRNT mode) + (Ver 2.5以降 - ESC/POS mode) + TSP650II (Ver 2.1以降) + TSP700II (Ver 5.1以降) + TSP800II (Ver 2.1以降) + TSP100IIIBI (Ver 1.0以降) + TSP100IIIW (Ver 1.4以降) + TSP100IIILAN (Ver 1.3以降) + TSP100IIIU (Ver 1.0以降) + TSP100IV (Ver 1.0以降) + FVP10 (Ver 2.0以降) + BSC10 *2 (Ver 1.0以降) + mPOP (Ver 1.0.1以降) + mC-Print2 (Ver 1.0以降) + mC-Print3 (Ver 1.0以降) + + *1-日本向けモデルのみ + *2-欧米向けモデルのみ + + ◇ 対応インターフェース + Bluetooth: TSPシリーズ (IFBD-HB03/HB04 Ver 1.0.0以上) + : ポータブルプリンタシリーズ + : mPOP, mC-Print2, mC-Print3 + Ethernet : TSPシリーズ, FVP10, BSC10 (IFBD-HE05/HE06 Ver 1.0.1以上) + : mC-Print2, mC-Print3 + USB : TSPシリーズ, FVP10, BSC10 (IFBD-HU07/HU08) + : mPOP, mC-Print2, mC-Print3 + +=========== + 4. 著作権 +=========== + スター精密(株)Copyright 2016 - 2021 + +====================================== + 5. Star PassPRNT Android SDK 更新履歴 +====================================== + + Ver 2.3.0 + 2021/10/29 : TSP100IVに対応 + ブザー(BU01), メロディースピーカー(mC-Sound)のサポートを追加 + + Ver 2.2 + 2020/01/23 : Webダウンロード印刷に対応 ('url'クエリ) + + Ver 2.1 + 2018/07/02 : 対応機種追加 + 印刷設定項目(クエリ)追加 + Blackmark仕様変更 + + Ver 2.0 + 2017/09/29 : 対応機種追加 + 印刷設定項目追加 + Blackmark仕様変更 + PDF印刷仕様変更 diff --git a/Samples/.gitignore b/Samples/.gitignore new file mode 100644 index 0000000..4c9e2c6 --- /dev/null +++ b/Samples/.gitignore @@ -0,0 +1,8 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures diff --git a/Samples/app/.gitignore b/Samples/app/.gitignore new file mode 100644 index 0000000..3543521 --- /dev/null +++ b/Samples/app/.gitignore @@ -0,0 +1 @@ +/build diff --git a/Samples/app/build.gradle b/Samples/app/build.gradle new file mode 100644 index 0000000..ac2b0e9 --- /dev/null +++ b/Samples/app/build.gradle @@ -0,0 +1,26 @@ +apply plugin: 'com.android.application' + +android { + compileSdkVersion 29 + buildToolsVersion '29.0.1' + + defaultConfig { + applicationId "jp.star_m.passprnttester" + minSdkVersion 21 + targetSdkVersion 29 + versionCode 6 + versionName "2.3.0" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + testImplementation 'junit:junit:4.12' + implementation 'androidx.appcompat:appcompat:1.1.0' +} diff --git a/Samples/app/proguard-rules.pro b/Samples/app/proguard-rules.pro new file mode 100644 index 0000000..1a17e21 --- /dev/null +++ b/Samples/app/proguard-rules.pro @@ -0,0 +1,17 @@ +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in /Users/koji/Library/Android/sdk/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the proguardFiles +# directive in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/Samples/app/src/androidTest/java/jp/star_m/passprnttester/ApplicationTest.java b/Samples/app/src/androidTest/java/jp/star_m/passprnttester/ApplicationTest.java new file mode 100644 index 0000000..a0624d9 --- /dev/null +++ b/Samples/app/src/androidTest/java/jp/star_m/passprnttester/ApplicationTest.java @@ -0,0 +1,13 @@ +package jp.star_m.passprnttester; + +import android.app.Application; +import android.test.ApplicationTestCase; + +/** + * Testing Fundamentals + */ +public class ApplicationTest extends ApplicationTestCase { + public ApplicationTest() { + super(Application.class); + } +} \ No newline at end of file diff --git a/Samples/app/src/main/AndroidManifest.xml b/Samples/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..144664c --- /dev/null +++ b/Samples/app/src/main/AndroidManifest.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/Samples/app/src/main/assets/font_ML.html b/Samples/app/src/main/assets/font_ML.html new file mode 100644 index 0000000..ea21ae3 --- /dev/null +++ b/Samples/app/src/main/assets/font_ML.html @@ -0,0 +1,25 @@ + + + + + Font Design + + + +

Hello. Thank you.

+

こんにちは。ありがとう。

+

Hallo. Danke.

+

Hola. Gracias.

+

您好。謝謝。

+

Здравствуйте. Спасибо.

+

Olá. Obrigado.

+

हैलो। धन्यवाद।

+

สวัสดี ขอบคุณ

+

안녕하세요. 감사합니다.

+

Bonjour. Merci.

+ + diff --git a/Samples/app/src/main/assets/index.html b/Samples/app/src/main/assets/index.html new file mode 100644 index 0000000..35e085b --- /dev/null +++ b/Samples/app/src/main/assets/index.html @@ -0,0 +1,63 @@ + + + + html1 + + +
+

STAR Shop

+
+
+ + + + + + + + + + + + + + + + + + + + + +
Pepsi@100101000
orange@1001100
banana@100101000
+
+ + + + + + + + + + + + + + + + + + + + + +
subtotal2100
tax105
total2205
+
+
+
+
+
Star Micronics
+
http://www.starmicronics.co.jp
+ + diff --git a/Samples/app/src/main/assets/receiptPDF.pdf b/Samples/app/src/main/assets/receiptPDF.pdf new file mode 100644 index 0000000..e7149ec Binary files /dev/null and b/Samples/app/src/main/assets/receiptPDF.pdf differ diff --git a/Samples/app/src/main/java/jp/star_m/passprnttester/MainActivity.java b/Samples/app/src/main/java/jp/star_m/passprnttester/MainActivity.java new file mode 100644 index 0000000..3095761 --- /dev/null +++ b/Samples/app/src/main/java/jp/star_m/passprnttester/MainActivity.java @@ -0,0 +1,1137 @@ +package jp.star_m.passprnttester; + +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; +import androidx.appcompat.app.AppCompatActivity; +import android.util.Base64; +import android.util.Log; +import android.view.View; +import android.widget.AdapterView; +import android.widget.Button; +import android.widget.ListView; +import android.widget.SimpleAdapter; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static java.lang.Integer.parseInt; +import static java.sql.DriverManager.println; + +public class MainActivity extends AppCompatActivity implements View.OnClickListener { + + List> listViewItems = new ArrayList<>(); + SimpleAdapter adapter; + private int selectedIndex; + + String m_portname = null; + String m_portSettings = null; + String m_timeout = null; + String m_width = null; + String m_drawer = null; + String m_pulse = null; + String m_buzzer = null; + String m_buzzerChannel = null; + String m_buzzerRepeat = null; + String m_buzzerDriveTime = null; + String m_buzzerDelayTime = null; + String m_sound = null; + String m_soundStorageArea = null; + String m_soundNumber = null; + String m_soundVolume = null; + String m_callBack = null; + String m_blackmark = null; + String m_cuttype = null; + String m_popup = null; + + String m_htmlReceiptData = null; + String m_pdfReceiptData = null; + String m_url = null; + + String[] fileList; + String[] pdfFileList; + + protected Button printButton = null; + protected ListView listView = null; + + @Override + protected void onPause() { + super.onPause(); + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + OutputReturnValue(); + + m_portname = (m_portname == null) ? "none" : m_portname; + m_portSettings = (m_portSettings == null) ? "none" : m_portSettings; + m_timeout = (m_timeout == null) ? "none" : m_timeout; + m_width = (m_width == null) ? "none" : m_width; + m_drawer = (m_drawer == null) ? "none" : m_drawer; + m_pulse = (m_pulse == null) ? "none" : m_pulse; + m_buzzer = (m_buzzer == null) ? "none" : m_buzzer; + m_buzzerChannel = (m_buzzerChannel == null) ? "none" : m_buzzerChannel; + m_buzzerRepeat = (m_buzzerRepeat == null) ? "none" : m_buzzerRepeat; + m_buzzerDriveTime = (m_buzzerDriveTime == null) ? "none" : m_buzzerDriveTime; + m_buzzerDelayTime = (m_buzzerDelayTime == null) ? "none" : m_buzzerDelayTime; + m_sound = (m_sound == null) ? "none" : m_sound; + m_soundStorageArea = (m_soundStorageArea == null) ? "none" : m_soundStorageArea; + m_soundNumber = (m_soundNumber == null) ? "none" : m_soundNumber; + m_soundVolume = (m_soundVolume == null) ? "none" : m_soundVolume; + m_callBack = (m_callBack == null) ? "startest://" : m_callBack; + m_blackmark = (m_blackmark == null) ? "none" : m_blackmark; + m_cuttype = (m_cuttype == null) ? "none" : m_cuttype; + m_popup = (m_popup == null) ? "none" : m_popup; + try { + String[] strList = getResources().getAssets().list(""); + + ArrayList stringArrayList = new ArrayList<>(); + stringArrayList.add("none"); + + ArrayList stringPdfArrayList = new ArrayList<>(); + stringPdfArrayList.add("none"); + + for (int i = 0; i < strList.length; i++) { + if (strList[i].contains(".html")) { + stringArrayList.add(strList[i]); + } else if (strList[i].contains(".pdf")) { + stringPdfArrayList.add(strList[i]); + } + } + fileList = stringArrayList.toArray(new String[0]); + pdfFileList = stringPdfArrayList.toArray(new String[0]); + + } catch (IOException e) { + e.printStackTrace(); + } + m_htmlReceiptData = "index.html"; + m_pdfReceiptData = "none"; + + m_url = (m_url == null) ? "none": m_url; + + adapter = new SimpleAdapter( + this, + listViewItems, + android.R.layout.simple_list_item_2, + new String[] {"main", "sub"}, + new int[] {android.R.id.text1, android.R.id.text2} + ); + + listView = findViewById(R.id.listView); + listView.setAdapter(adapter); + + printButton = findViewById(R.id.button); + printButton.setOnClickListener(this); + + refreshListInfo(); + + listView.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + switch (position) { + case 0: //PortName + // Communicate with... + // "none" : the printer is configured on setting display + // "bt:" : the printer is first detected by OS + // "bt:xxx" : the printer is named as xxx + // "usb:" : the printer is first detected by OS + // "usb:SN:xxx" : the printer is configured serial number as xxx + final String[] portNameIndexList = {"none", "bt:", "tcp:", "usb:"}; + + for (int i = 0; i < portNameIndexList.length; i++) { + if (portNameIndexList[i].equalsIgnoreCase(m_portname)) { + selectedIndex = i; + break; + } + } + + new AlertDialog.Builder(view.getContext()) + .setTitle("Port Name") + .setSingleChoiceItems(portNameIndexList, selectedIndex, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + selectedIndex = which; + } + }) + .setPositiveButton("OK", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + m_portname = portNameIndexList[selectedIndex]; + refreshListInfo(); + } + }) + .setNegativeButton("Cancel", null) + .show(); + break; + case 1: //PortSettings + // Configured for communicate with + // "none" : Desktop models ex:) TSP650II + // "portable" : Portable models(StarPRNT mode) ex:) SM-T300i + final String[] portSettingsIndexList = {"none", "blank", "portable", "portable;escpos", "escpos"}; + + for (int i = 0; i < portSettingsIndexList.length; i++) { + if (portSettingsIndexList[i].equalsIgnoreCase(m_portSettings)) { + selectedIndex = i; + break; + } + } + + new AlertDialog.Builder(view.getContext()) + .setTitle("Port Settings") + .setSingleChoiceItems(portSettingsIndexList, selectedIndex, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + selectedIndex = which; + } + }) + .setPositiveButton("OK", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + m_portSettings = portSettingsIndexList[selectedIndex]; + refreshListInfo(); + } + }) + .setNegativeButton("Cancel", null) + .show(); + break; + case 2: //Timeout + // Configured for printing area + final String[] timeoutIndexList = {"none", "10000"}; + + for (int i = 0; i < timeoutIndexList.length; i++) { + if (timeoutIndexList[i].equalsIgnoreCase(m_timeout)) { + selectedIndex = i; + break; + } + } + + new AlertDialog.Builder(view.getContext()) + .setTitle("Timeout") + .setSingleChoiceItems(timeoutIndexList, selectedIndex, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + selectedIndex = which; + } + }) + .setPositiveButton("OK", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + m_timeout = timeoutIndexList[selectedIndex]; + refreshListInfo(); + } + }) + .setNegativeButton("Cancel", null) + .show(); + break; + case 3: //Width + // Configured for printing area + final String[] widthIndexList = {"none", "2", "2w1", "2w2", "2w3", "2w4", "3", "3w", "3w2", "4"}; + + for (int i = 0; i < widthIndexList.length; i++) { + if (widthIndexList[i].equalsIgnoreCase(m_width)) { + selectedIndex = i; + break; + } + } + + new AlertDialog.Builder(view.getContext()) + .setTitle("Print Width") + .setSingleChoiceItems(widthIndexList, selectedIndex, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + selectedIndex = which; + } + }) + .setPositiveButton("OK", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + m_width = widthIndexList[selectedIndex]; + refreshListInfo(); + } + }) + .setNegativeButton("Cancel", null) + .show(); + break; + case 4: //Drawer + final String[] drawerIndexList = {"none", "Off", "Before printing", "After printing"}; + + for (int i = 0; i < drawerIndexList.length; i++) { + if (drawerIndexList[i].equalsIgnoreCase(m_drawer)) { + selectedIndex = i; + break; + } + } + + new AlertDialog.Builder(view.getContext()) + .setTitle("Drawer") + .setSingleChoiceItems(drawerIndexList, selectedIndex, new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + selectedIndex = which; + } + }) + .setPositiveButton("OK", new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + m_drawer = drawerIndexList[selectedIndex]; + refreshListInfo(); + } + }) + .setNegativeButton("Cancel", null) + .show(); + break; + case 5: //Pulse + final String[] pulseIndexList = {"none", "200", "500"}; + + for (int i = 0; i map0 = new HashMap<>(); + map0.put("main", "Port Name(port=)"); + map0.put("sub", m_portname); + listViewItems.add(map0); + + //settings + Map map1 = new HashMap<>(); + map1.put("main", "Port Settings(settings=)"); + map1.put("sub", m_portSettings); + listViewItems.add(map1); + + //timeout + Map map2 = new HashMap<>(); + map2.put("main", "Timeout(timeout=)"); + map2.put("sub", m_timeout); + listViewItems.add(map2); + + //size + Map map3 = new HashMap<>(); + map3.put("main", "Width(size=)"); + map3.put("sub", m_width); + listViewItems.add(map3); + + //drawer + Map map4 = new HashMap<>(); + map4.put("main", "Drawer(drawer=)"); + map4.put("sub", m_drawer); + listViewItems.add(map4); + + //pulse + Map map5 = new HashMap<>(); + map5.put("main", "Drawer Pulse(drawerpulse=)"); + map5.put("sub", m_pulse); + listViewItems.add(map5); + + // buzzer + Map buzzerMap = new HashMap<>(); + buzzerMap.put("main", "Buzzer(buzzer=)"); + buzzerMap.put("sub", m_buzzer); + listViewItems.add(buzzerMap); + + // buzzerChannel + Map buzzerChannelMap = new HashMap<>(); + buzzerChannelMap.put("main", "Buzzer Channel(buzzerchannel=)"); + buzzerChannelMap.put("sub", m_buzzerChannel); + listViewItems.add(buzzerChannelMap); + + // buzzerRepeat + Map buzzerRepeatMap = new HashMap<>(); + buzzerRepeatMap.put("main", "Buzzer Repeat(buzzerrepeat=)"); + buzzerRepeatMap.put("sub", m_buzzerRepeat); + listViewItems.add(buzzerRepeatMap); + + // buzzerDriveTime + Map buzzerDriveTimeMap = new HashMap<>(); + buzzerDriveTimeMap.put("main", "Buzzer Drive Time(buzzerdrivetime=)"); + buzzerDriveTimeMap.put("sub", m_buzzerDriveTime); + listViewItems.add(buzzerDriveTimeMap); + + // buzzerDelayTime + Map buzzerDelayTimeMap = new HashMap<>(); + buzzerDelayTimeMap.put("main", "Buzzer Delay Time(buzzerdelaytime=)"); + buzzerDelayTimeMap.put("sub", m_buzzerDelayTime); + listViewItems.add(buzzerDelayTimeMap); + + // sound + Map soundMap = new HashMap<>(); + soundMap.put("main", "Sound(sound=)"); + soundMap.put("sub", m_sound); + listViewItems.add(soundMap); + + // soundStorageArea + Map soundStorageAreaMap = new HashMap<>(); + soundStorageAreaMap.put("main", "Sound Storage Area(soundstoragearea=)"); + soundStorageAreaMap.put("sub", m_soundStorageArea); + listViewItems.add(soundStorageAreaMap); + + // soundNumber + Map soundNumberMap = new HashMap<>(); + soundNumberMap.put("main", "Sound Number(soundnumber=)"); + soundNumberMap.put("sub", m_soundNumber); + listViewItems.add(soundNumberMap); + + // soundVolume + Map soundVolumeMap = new HashMap<>(); + soundVolumeMap.put("main", "Sound Volume(soundvolume=)"); + soundVolumeMap.put("sub", m_soundVolume); + listViewItems.add(soundVolumeMap); + + //callback + Map map6 = new HashMap<>(); + map6.put("main", "Call Back(back=)"); + map6.put("sub", m_callBack); + listViewItems.add(map6); + + //black mark + Map map7 = new HashMap<>(); + map7.put("main", "Black Mark(blackmark=)"); + map7.put("sub", m_blackmark); + listViewItems.add(map7); + + //cuttype + Map map8 = new HashMap<>(); + map8.put("main", "Cut Type(cut=)"); + map8.put("sub", m_cuttype); + listViewItems.add(map8); + + //popup + Map map9 = new HashMap<>(); + map9.put("main", "Popup(popup=)"); + map9.put("sub", m_popup); + listViewItems.add(map9); + + //html Receipt data + Map map10 = new HashMap<>(); + map10.put("main", "Receipt(html=)"); + map10.put("sub", m_htmlReceiptData); + listViewItems.add(map10); + + //pdf Receipt data + Map map11 = new HashMap<>(); + map11.put("main", "Receipt(pdf=)"); + map11.put("sub", m_pdfReceiptData); + listViewItems.add(map11); + + //url + Map map12 = new HashMap<>(); + map12.put("main", "Receipt(url=)"); + map12.put("sub", m_url); + listViewItems.add(map12); + + adapter.notifyDataSetChanged(); + } + + private byte[] generatePrintData(String file) { + InputStream is = null; + byte[] readBytes = null; + + try { + try { + // open a file on assets folder + is = this.getAssets().open(file); + + readBytes = new byte[is.available()]; + is.read(readBytes); + + } finally { + if (is != null) is.close(); + } + } catch (Exception e){ + // Do nothing + } + return readBytes; + } + + private String generatePrintData2(String file) { + String data = ""; + + InputStream is = null; + BufferedReader br = null; + + try { + try { + // open a file on assets folder + is = this.getAssets().open(file); + br = new BufferedReader(new InputStreamReader(is)); + + String str; + + // read data line by line + while ((str = br.readLine()) != null) { + data += str; + } + } finally { + if (is != null) is.close(); + if (br != null) br.close(); + } + } catch (Exception e){ + // Do nothing + } + + return data; + } + + private void OutputReturnValue() { + Intent intent = getIntent(); + + if (intent.getScheme() == null) + return; + + // If you need the part of query in scheme, + // you can use "intent.getData().getQuery()" + // instead of "intent.getDataString()". + new AlertDialog.Builder(this) + .setTitle("Result") + .setMessage(intent.getDataString()) + .setPositiveButton("OK", null) + .show(); + } +} diff --git a/Samples/app/src/main/res/layout/activity_main.xml b/Samples/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..213f02e --- /dev/null +++ b/Samples/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,29 @@ + + + +