4.1. StarIoExt
ヒューマンリーダブルなコマンド生成や周辺機器操作などの機能を提供します。
列挙体
名称
説明
エミュレーション指定定数
文字コード指定定数
バーコードリーダーモデル指定定数
カスタマーディスプレイモデル指定定数
メロディスピーカーモデル指定定数
LEDモデル指定定数
メソッド
名称
説明
コマンド生成オブジェクトを生成します。
カスタマーディスプレイコマンド生成オブジェクトを生成します。
メロディスピーカーコマンド生成オブジェクトを生成します。
プレゼンターコマンド生成オブジェクトを生成します。
LEDコマンド生成オブジェクトを生成します。
ベゼルコマンド生成オブジェクトを生成します。
バーコードリーダー接続確認コマンド応答解析オブジェクトを生成します。
カスタマーディスプレイ接続確認コマンド応答解析オブジェクトを生成します。
メロディスピーカー接続確認コマンド応答解析オブジェクトを生成します。
プレゼンターの用紙カウンタ値取得コマンド応答解析オブジェクトを生成します。
4.1.1. Emulation
エミュレーション指定定数です。
宣言
public enum Emulation { None, StarPRNT, StarPRNTL, StarLine, StarGraphic, EscPos, EscPosMobile, StarDotImpact }
定数
名称
説明
StarPRNT
StarPRNT エミュレーション
StarPRNTL
StarPRNTL エミュレーション
StarLine
STAR Line Mode エミュレーション
StarGraphic
STAR Graphic Mode エミュレーション
EscPos
ESC/POS エミュレーション
EscPosMobile
ESC/POS Mobile エミュレーション
StarDotImpact
STAR ドットインパクト エミュレーション
StarPRNTL エミュレーションについて
ラスターイメージ印字コマンドを生成する appendBitmap 系メソッドでコマンドサイズを削減したStarPRNTエミュレーションです。 ラスターイメージコマンド送信に掛かる時間が短縮されます。
StarPRNT エミュレーションをサポートするモデルのうち、一部モデルのみ選択可能です。 使用可能なモデルは 対応プリンター を参照ください。
各モデルに対して適用すべきEmulation定数は以下のとおりです。
モデル |
エミュレーション |
定数 |
---|---|---|
mC-Print2 | StarPRNT | StarPRNT |
mC-Print3 | StarPRNT | StarPRNT |
mC-Label3 | StarPRNT | StarPRNT |
mPOP | StarPRNT | StarPRNT |
FVP10 | StarLine | StarLine |
TSP100IV | StarPRNT | StarPRNT |
TSP100IV SK | StarPRNT | StarPRNT |
TSP100IIIW | StarGraphic | StarGraphic |
TSP100IIILAN | StarGraphic | StarGraphic |
TSP100IIIBI | StarGraphic | StarGraphic |
TSP100IIIU | StarGraphic | StarGraphic |
TSP100IIU+ | StarGraphic | StarGraphic |
TSP100ECO | StarGraphic | StarGraphic |
TSP100U | StarGraphic | StarGraphic |
TSP100GT | StarGraphic | StarGraphic |
TSP100LAN | StarGraphic | StarGraphic |
TSP650II | StarLine | StarLine |
TSP650IISK | StarLine | StarLine |
TSP700II | StarLine | StarLine |
TSP800II | StarLine | StarLine |
TUP500 | StarLine | StarLine |
BSC10 | StarLine | EscPos |
SM-S210i | StarPRNT | StarPRNT |
EscPosMobile | EscPosMobile |
|
SM-S220i | StarPRNT | StarPRNT |
EscPosMobile | EscPosMobile |
|
SM-S230i | StarPRNT | StarPRNT |
EscPosMobile | EscPosMobile |
|
SM-T300i/T300 | StarPRNT | StarPRNT |
EscPosMobile | EscPosMobile |
|
SM-T400i | StarPRNT | StarPRNT |
EscPosMobile | EscPosMobile |
|
SM-L200 | StarPRNT | StarPRNT |
StarPRNTL |
||
SM-L300 | StarPRNT | StarPRNT |
StarPRNTL |
||
SP700 | StarDotImpact | StarDotImpact |
SK1-211/221/V211/ | StarPRNT | StarPRNT |
SK1-211/221/V211 Presenter | StarPRNT | StarPRNT |
SK1-311/321/V311 | StarPRNT | StarPRNT |
SK1-311/V311 Presenter | StarPRNT | StarPRNT |
4.1.2. CharacterCode
文字コード指定定数です。
宣言
public enum CharacterCode { None, Standard, Japanese, SimplifiedChinese, TraditionalChinese }
定数
名称
説明
Standard
スタンダード
Japanese
日本語
SimplifiedChinese
簡体字中国語
TraditionalChinese
繁体字中国語
4.1.3. BcrModel
バーコードリーダーモデル指定定数です。
宣言
public enum BcrModel { None, POP1, DS9208 }
定数
名称
説明
ライブラリバージョン
POP1
バーコードリーダー BCR-POP1
USB HIDクラス(キーボードモード)
1.3.0+ DS9208
バーコードリーダー DS9208
1.10.0+
4.1.4. DisplayModel
added in version 1.6.0
カスタマーディスプレイモデル指定定数です。
宣言
public enum DisplayModel { None, SCD222 }
定数
名称
説明
SCD222
カスタマーディスプレイ SCD222U
4.1.5. MelodySpeakerModel
added in version 1.10.0
メロディスピーカーモデル指定定数です。
宣言
public enum MelodySpeakerModel { None, MCS10, FVP10 }
定数
名称
説明
MCS10
メロディスピーカー MCS10
FVP10
FVP10 内蔵スピーカー
4.1.6. LedModel
added in version 1.13.0
LEDモデル指定定数です。
宣言
public enum LedModel { None, Star, SK }
定数
名称
説明
Star
StarのLED表示器
SK
SKシリーズのLED表示器
4.1.7. createCommandBuilder
コマンド生成オブジェクトを生成します。
宣言
public static ICommandBuilder createCommandBuilder(Emulation emulation);
引数
戻り値
説明
型
ICommandBuilder オブジェクト
実装例
public static byte[] createCommandsImage(Emulation emulation, Bitmap bitmap) { ICommandBuilder builder = StarIoExt.createCommandBuilder(emulation); builder.beginDocument(); builder.appendBitmap(bitmap, false); builder.appendCutPaper(CutPaperAction.PartialCutWithFeed); builder.endDocument(); return builder.getCommands(); }
PrinterFunctions.java を参照ください。
4.1.8. createDisplayCommandBuilder
added in version 1.6.0
カスタマーディスプレイコマンド生成オブジェクトを生成します。
宣言
public static IDisplayCommandBuilder createDisplayCommandBuilder(DisplayModel model);
引数
名称
説明
型
model
カスタマーディスプレイモデル指定定数
戻り値
説明
型
IDisplayCommandBuilder オブジェクト
実装例
public static byte[] createTextPattern(int number) { IDisplayCommandBuilder builder = StarIoExt.createDisplayCommandBuilder(DisplayModel.SCD222); builder.appendClearScreen(); builder.appendCursorMode(CursorMode.Off); builder.appendHomePosition(); byte[] pattern; builder.append(pattern); return builder.getPassThroughCommands(); }
DisplayFunctions.java を参照ください。
4.1.9. createMelodySpeakerCommandBuilder
added in version 1.10.0
メロディスピーカーコマンド生成オブジェクトを生成します。
宣言
public static IMelodySpeakerCommandBuilder createMelodySpeakerCommandBuilder(MelodySpeakerModel model);
引数
名称
説明
型
model
メロディスピーカーモデル指定定数
戻り値
説明
型
IMelodySpeakerCommandBuilder オブジェクト
実装例
public static byte[] createPlayingRegisteredSound(MelodySpeakerModel model, SoundStorageArea soundStorageArea, boolean specifySound, int soundNumber, boolean specifyVolume, int volume) { IMelodySpeakerCommandBuilder builder = StarIoExt.createMelodySpeakerCommandBuilder(model); SoundSetting setting = new SoundSetting(); if (specifySound) { setting.setSoundStorageArea(soundStorageArea); setting.setSoundNumber(soundNumber); } if (specifyVolume) { setting.setVolume(volume); } builder.appendSound(setting); return builder.getCommands(); }
MelodySpeakerFunctions.java を参照ください。
4.1.10. createPresenterCommandBuilder
added in version 1.13.0
プレゼンターコマンド生成オブジェクトを生成します。
宣言
public static IPresenterCommandBuilder createPresenterCommandBuilder(Emulation emulation);
引数
名称
説明
型
emulation
エミュレーション指定
戻り値
説明
型
IPresenterCommandBuilderオブジェクト
実装例
public static byte[] createSetPresenterOperation(Emulation emulation, Mode mode, PaperRetractFunction retractFunction, int holdTime) { IPresenterCommandBuilder builder = StarIoExt.createPresenterCommandBuilder(emulation); PresenterSetting setting = new PresenterSetting(); setting.setMode(mode); setting.setPaperRetractFunction(retractFunction); if (retractFunction == PaperRetractFunction.Retract || retractFunction == PaperRetractFunction.Eject) { setting.setPaperHoldTime(holdTime); } builder.appendOperation(setting); return builder.getCommands(); }
PresenterFunctions.java を参照ください。
4.1.11. createLedCommandBuilder
added in version 1.13.0
LEDコマンド生成オブジェクトを生成します。
宣言
public static ILedCommandBuilder createLedCommandBuilder(LedModel model);
引数
名称
説明
型
model
LEDモデル指定定数
戻り値
説明
型
ILedCommandBuildeオブジェクト
実装例
private void print() { ... LedModel model = ModelCapability.getLedModel(mPrinterSettings.getModelIndex()); ILedCommandBuilder ledBuilder = StarIoExt.createLedCommandBuilder(model); try { ledBuilder.appendAutomaticBlinkMode(leds); List ledList = Arrays.asList(leds); if (ledList.contains(Led.Printing)) { ledBuilder.appendAutomaticBlinkInterval(Led.Printing, printingLedOnTime, printingLedOffTime); } if (ledList.contains(Led.Error)) { ledBuilder.appendAutomaticBlinkInterval(Led.Error, errorLedOnTime, errorLedOffTime); } if (ledList.contains(Led.Idle)) { ledBuilder.appendAutomaticBlinkInterval(Led.Idle, idleLedOnTime, idleLedOffTime); } } catch (IllegalArgumentException e) { ... } ... }
LedFragment.java を参照ください。
4.1.12. createBezelCommandBuilder
added in version 1.14.0
ベゼルコマンド生成オブジェクトを生成します。
宣言
public static IBezelCommandBuilder createBezelCommandBuilder(Emulation emulation)
引数
名称
説明
型
emulation
エミュレーション指定
戻り値
説明
型
IBezelCommandBuilderオブジェクト
実装例
public static List<byte[]> createHoldPrintData(Emulation emulation, boolean[] isHoldArray) { List<byte[]> commandList = new ArrayList<>(); for (int i = 0; i < isHoldArray.length; i++) { ICommandBuilder builder = StarIoExt.createCommandBuilder(emulation); builder.beginDocument(); IBezelCommandBuilder bezelBuilder = StarIoExt.createBezelCommandBuilder(emulation); // Enable bezel. bezelBuilder.appendBezelMode(Mode.Valid); builder.append(bezelBuilder.getCommands()); // Disable hold print controlled by printer firmware. builder.appendHoldPrint(HoldPrintType.Invalid); ... } return commandList; }
PrinterFunctions.java を参照ください。
4.1.13. createBcrConnectParser
バーコードリーダー接続確認コマンド応答解析オブジェクトを生成します。
宣言
public static IPeripheralConnectParser createBcrConnectParser(BcrModel model);
引数
名称
説明
型
model
バーコードリーダーモデル指定定数
戻り値
説明
型
IPeripheralConnectParser オブジェクト
4.1.14. createDisplayConnectParser
added in version 1.6.0
カスタマーディスプレイ接続確認コマンド応答解析オブジェクトを生成します。
宣言
public static IPeripheralConnectParser createDisplayConnectParser(DisplayModel model);
引数
名称
説明
型
model
カスタマーディスプレイモデル指定定数
戻り値
説明
型
IPeripheralConnectParser オブジェクト
実装例
public void onItemClick(final AdapterView<?> parent, View view, final int position, long id) { super.onItemClick(parent, view, position, id); CommonAlertDialogFragment dialog = null; if (position == 1) { mProgressDialog.show(); PrinterSetting setting = new PrinterSetting(getActivity()); final IPeripheralConnectParser parser = StarIoExt.createDisplayConnectParser(DisplayModel.SCD222); Communication.parseDoNotCheckCondition(DisplayFragment.class, parser, setting.getPortName(), setting.getPortSettings(), 10000, getActivity(), new Communication.SendCallback() { @Override public void onStatus(boolean result, Communication.Result communicateResult) { ... String msg; String title; if (result) { title = "Check Status"; if (parser.isConnected()) { msg = "Display Connect"; } else { msg = "Display Disconnect"; } } else { title = "Communication Result"; msg = "Printer Impossible"; } ... } }); } ... }
DisplayFragment.java/DisplayExtFragment.java を参照ください。
4.1.15. createMelodySpeakerConnectParser
added in version 1.10.0
メロディスピーカー接続確認コマンド応答解析オブジェクトを生成します。
宣言
public static IPeripheralConnectParser createMelodySpeakerConnectParser(MelodySpeakerModel model);
引数
名称
説明
型
model
メロディスピーカーモデル指定定数
戻り値
説明
型
IPeripheralConnectParser オブジェクト
例外
クラス
説明
UnsupportedOperationException
FVP10 指定時に本メソッドが呼ばれた場合
実装例
private void playRegisteredSound() { mProgressDialog.show(); PrinterSettingManager settingManager = new PrinterSettingManager(getActivity()); PrinterSettings settings = settingManager.getPrinterSettings(); if (mMelodySpeakerModel == MelodySpeakerModel.MCS10) { final IPeripheralConnectParser parser = StarIoExt.createMelodySpeakerConnectParser(MelodySpeakerModel.MCS10); Communication.parseDoNotCheckCondition(MelodySpeakerFragment.class, parser, settings.getPortName(), settings.getPortSettings(), 10000, getActivity(), new Communication.SendCallback() { @Override public void onStatus(boolean result, Communication.Result communicateResult) { if (!mIsForeground) { return; } String msg; String title; if (result) { if (parser.isConnected()) { sendRegisteredSoundCommand(); return; } else { title = "Check Status"; msg = "MelodySpeaker Disconnect"; } } else { title = "Communication Result"; msg = "Printer Impossible"; } } ... }); } ... }
MelodySpeakerFragment.java を参照ください。
4.1.16. createPresenterPaperCounterParser
added in version 1.13.0
プレゼンターの用紙カウンタ値取得コマンド応答解析オブジェクトを生成します。
宣言
public static IPresenterPaperCounterParser createPresenterPaparCounterParser(Emulation emulation);
引数
名称
説明
型
emulation
エミュレーション指定
戻り値
説明
型
プレゼンターの用紙カウンタ値取得コマンド応答解析オブジェクト