From 1c7b645a3a934b69737aed022a86a668ada42594 Mon Sep 17 00:00:00 2001 From: bandit-ibayashi Date: Mon, 16 May 2022 13:46:37 +0900 Subject: [PATCH] V2.3.0 --- Readme_En.txt | 122 ++ Readme_Jp.txt | 121 ++ Samples/.gitignore | 8 + Samples/app/.gitignore | 1 + Samples/app/build.gradle | 26 + Samples/app/proguard-rules.pro | 17 + .../passprnttester/ApplicationTest.java | 13 + Samples/app/src/main/AndroidManifest.xml | 28 + Samples/app/src/main/assets/font_ML.html | 25 + Samples/app/src/main/assets/index.html | 63 + Samples/app/src/main/assets/receiptPDF.pdf | Bin 0 -> 17130 bytes .../star_m/passprnttester/MainActivity.java | 1137 +++++++++++++++++ .../app/src/main/res/layout/activity_main.xml | 29 + .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin 0 -> 3418 bytes .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin 0 -> 2206 bytes .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin 0 -> 4842 bytes .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin 0 -> 7718 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin 0 -> 10486 bytes .../app/src/main/res/values-w820dp/dimens.xml | 6 + Samples/app/src/main/res/values/colors.xml | 6 + Samples/app/src/main/res/values/dimens.xml | 5 + Samples/app/src/main/res/values/strings.xml | 4 + Samples/app/src/main/res/values/styles.xml | 11 + .../passprnttester/ExampleUnitTest.java | 15 + Samples/build.gradle | 25 + Samples/gradle.properties | 20 + Samples/gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 53637 bytes .../gradle/wrapper/gradle-wrapper.properties | 6 + Samples/gradlew | 160 +++ Samples/gradlew.bat | 90 ++ Samples/settings.gradle | 1 + SoftwareLicenseAgreement.pdf | Bin 0 -> 147954 bytes SoftwareLicenseAgreement_Jp.pdf | Bin 0 -> 224496 bytes UsersManual_Android.url | 5 + 34 files changed, 1944 insertions(+) create mode 100644 Readme_En.txt create mode 100644 Readme_Jp.txt create mode 100644 Samples/.gitignore create mode 100644 Samples/app/.gitignore create mode 100644 Samples/app/build.gradle create mode 100644 Samples/app/proguard-rules.pro create mode 100644 Samples/app/src/androidTest/java/jp/star_m/passprnttester/ApplicationTest.java create mode 100644 Samples/app/src/main/AndroidManifest.xml create mode 100644 Samples/app/src/main/assets/font_ML.html create mode 100644 Samples/app/src/main/assets/index.html create mode 100644 Samples/app/src/main/assets/receiptPDF.pdf create mode 100644 Samples/app/src/main/java/jp/star_m/passprnttester/MainActivity.java create mode 100644 Samples/app/src/main/res/layout/activity_main.xml create mode 100644 Samples/app/src/main/res/mipmap-hdpi/ic_launcher.png create mode 100644 Samples/app/src/main/res/mipmap-mdpi/ic_launcher.png create mode 100644 Samples/app/src/main/res/mipmap-xhdpi/ic_launcher.png create mode 100644 Samples/app/src/main/res/mipmap-xxhdpi/ic_launcher.png create mode 100644 Samples/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png create mode 100644 Samples/app/src/main/res/values-w820dp/dimens.xml create mode 100644 Samples/app/src/main/res/values/colors.xml create mode 100644 Samples/app/src/main/res/values/dimens.xml create mode 100644 Samples/app/src/main/res/values/strings.xml create mode 100644 Samples/app/src/main/res/values/styles.xml create mode 100644 Samples/app/src/test/java/jp/star_m/passprnttester/ExampleUnitTest.java create mode 100644 Samples/build.gradle create mode 100644 Samples/gradle.properties create mode 100644 Samples/gradle/wrapper/gradle-wrapper.jar create mode 100644 Samples/gradle/wrapper/gradle-wrapper.properties create mode 100644 Samples/gradlew create mode 100644 Samples/gradlew.bat create mode 100644 Samples/settings.gradle create mode 100644 SoftwareLicenseAgreement.pdf create mode 100644 SoftwareLicenseAgreement_Jp.pdf create mode 100644 UsersManual_Android.url 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 0000000000000000000000000000000000000000..e7149ecaa3e209dc372f5801354d3a7f30379a2a GIT binary patch literal 17130 zcmdtK1z6PE*FQRdbV-A>3P{c{FrSRg|4RP3>f9-X8}JyZfUrqthAAyMo=(SP#vVN=Z`AVKR#rBd?=zR zgsLK~?JcBHzDA%aj0Fx8cBvb|IV(V$g!Y?8UN4N6ubVph^6BGC*lw4nSp-`YaX69UnY3a7Q zv|77}i_^1SgmG$+;WgsvW=JMXlb1bKWmK>~_z)DHR3zN(ySqX}6;hz;?jkVtE`MZ0 zG+^)Rp3~+mCq*;VHe20E(2TLVl2+2cG3jz*0Y_iMtxqp6Mun*ci(h`KQfJos3}!55 zbFu0@%7ujV%)xDFHwmf4!{I%Bp`-n;)0EFg7DsOLt3OKV7kryKI8JACd%7a>$ikDK zarxtNS^7$4Gy87JLEs}*iK$m?Tn-PSFI$ZoCLu6WS&G|@?-i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$iGSZ(|2$z6%76Fo_>(|gCO*o)qltbB#MZLo|gPwimrP~Fu3=3*}waP zv4BYPU!(keg{J23(a|)Zr{I)}({eNy0$`-SsRKR#G9CY%(+1P=cf(UrqRIPt_#bzF z{6&-bKl%N+{STR;nM5=9H-l(m(bs>E4Py}j1pl~uTKAMD^wr;!_(RUM?2+Y z1rbuhQi3pqtegx&L{1vcFD&uj*8l_jXVc1$5dHORHKOMoalHmnhy_Q2DC=$d`XD7w z7Afl2HdyTD7&zwSmxe>aqU#$Z%fE6Ml@f+OZ-KXezV^8tn<;Etk0EYNeuLbX^VkIc zvC?y{vH1JWd5v#F*mBHCY9mSvhfPj&ncU4oiLoz9+o&X&2+ZY0Z{J-@lASC#2`uGLlu;2QF!9d&J=K%4CGN9Z4Fjv2q z0gLckJ<;FG;6N1rt_SD;LmB)JWq*(x{11Epx&1!IANYU+efJwJf8Ybi^0#^df8ayl z4}1vxfe)Y=fA8-Pe1H}Dd%ZvKA@B!21pdH>z#sS!`~x3g4gEH*;2-!9`~x4raQ@!* z4}1vzfe*ny@FDmIJ_P^32f#wVjf?mLA7CH-UhfZlApXDy;tzZPjqz)L{DN@s2+gni zoL^87tb>1-3Bv&H`b8fAWiIg3p7wONuy;bbpZ-&ZQ^Ozx`+waU{LuFn?w&ssCqDuq zDhU2d1e=_?JouLZe<@R-OaH&14XWXe^kz9F35vFsz)b|-z?A))XdzJq|6fG^Ux;Pg AUjP6A literal 0 HcmV?d00001 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 @@ + + + +