4.3. IDisplayCommandBuilder
added in version 1.6.0
カスタマーディスプレイ制御用コマンドを生成する機能を提供するインターフェイスです。
本インターフェイスは、カスタマーディスプレイに対応しているモデル専用です。 対応しているモデルは 対応外部機器 を参照ください。
列挙体
名称
説明
国際文字指定定数
コードページ指定定数
カーソルモード指定定数
コントラストモード指定定数
メソッド
名称
説明
データ(テキストやコマンド)をコマンドバッファに追加します。
バックスペースコマンドを生成し、コマンドバッファに追加します。
水平タブコマンドを生成し、コマンドバッファに追加します。
ラインフィードコマンドを生成し、コマンドバッファに追加します。
キャリッジリターンコマンドを生成し、コマンドバッファに追加します。
グラフィック表示コマンドを生成し、コマンドバッファに追加します。
国際文字指定コマンドを生成し、コマンドバッファに追加します。
コードページ指定コマンドを生成し、コマンドバッファに追加します。
画面を行末までクリアするコマンドを生成し、コマンドバッファに追加します。
画面をクリアするコマンドを生成し、コマンドバッファに追加します。
カーソルをホームポジションに移動するコマンドを生成し、コマンドバッファに追加します。
バックライトをオン・オフするコマンドを生成し、コマンドバッファに追加します。
カーソルを指定された位置に移動するコマンドを生成し、コマンドバッファに追加します。
カーソルモード変更コマンドを生成し、コマンドバッファに追加します。
コントラストモード変更コマンドを生成し、コマンドバッファに追加します。
ユーザー定義文字(SBCS)登録コマンドを生成し、コマンドバッファに追加します。
ユーザー定義文字(DBCS)登録コマンドを生成し、コマンドバッファに追加します。
コマンドバッファ(生成したコマンド)を取得します。
コマンドバッファ(生成したコマンド)の先頭にプリンタへのパススルーコマンドが追加されたコマンド列を取得します。
4.3.1. InternationalType
added in version 1.6.0
国際文字指定定数です。
宣言
enum InternationalType { USA, France, Germany, UK, Denmark, Sweden, Italy, Spain, Japan, Norway, Denmark2, Spain2, LatinAmerica, Korea }
定数
名称
説明
USA
アメリカ
France
フランス
Germany
ドイツ
UK
イギリス
Denmark
デンマーク
Sweden
スウェーデン
Italy
イタリア
Spain
スペイン
Japan
日本
Norway
ノルウェー
Denmark2
デンマークII
Spain2
スペインII
LatinAmerica
ラテンアメリカ
Korea
韓国
4.3.2. CodePageType
added in version 1.6.0
コードページ指定定数です。
宣言
enum CodePageType { CP437, Katakana, CP850, CP860, CP863, CP865, CP1252, CP866, CP852, CP858, Japanese, SimplifiedChinese, TraditionalChinese, Hangul }
定数
名称
説明
CP437
CodePage437 (USA, Std. Europe)
Katakana
Katakana
CP850
PC850 (Multilingual)
CP860
PC860 (Portuguese)
CP863
PC863 (Canadian-French)
CP865
PC865 (Norwegian)
CP1252
WPC1252
CP866
PC866 [Cyrillic #2]
CP852
PC852 [Latin 2]
CP858
Page 19 [PC858]
Japanese
Japanese font (shift JIS)
SimplifiedChinese
Simplified Chinese (GB2312)
TraditionalChinese
Traditional Chinese (Big5)
Hangul
Hangul (KSC5601)
4.3.3. CursorMode
added in version 1.6.0
カーソルモード指定定数です。
宣言
enum CursorMode { Off, Blink, On }
定数
名称
説明
Off
カーソル消灯
Blink
カーソル点滅
On
カーソル点灯
4.3.4. ContrastMode
added in version 1.6.0
コントラストモード指定定数です。
宣言
enum ContrastMode { Minus3, Minus2, Minus1, Default, Plus1, Plus2, Plus3 }
定数
名称
説明
Minus3
コントラスト マイナス3
Minus2
コントラスト マイナス2
Minus1
コントラスト マイナス1
Default
デフォルト
Plus1
コントラスト プラス1
Plus2
コントラスト プラス2
Plus3
コントラスト プラス3
4.3.5. append
added in version 1.6.0
データ(テキストやコマンド)をコマンドバッファに追加します。
宣言
void append(byte data); void append(byte[] data);
引数
名称
説明
型
data
データ(テキストやコマンド)
bytebyte[]戻り値
なし
実装例
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.3.6. appendBackSpace
added in version 1.6.0
バックスペースコマンドを生成し、コマンドバッファに追加します。
宣言
void appendBackSpace();
引数
なし
戻り値
なし
4.3.7. appendHorizontalTab
added in version 1.6.0
水平タブコマンドを生成し、コマンドバッファに追加します。
宣言
void appendHorizontalTab();
引数
なし
戻り値
なし
4.3.8. appendLineFeed
added in version 1.6.0
ラインフィードコマンドを生成し、コマンドバッファに追加します。
宣言
void appendLineFeed();
引数
なし
戻り値
なし
4.3.9. appendCarriageReturn
added in version 1.6.0
キャリッジリターンコマンドを生成し、コマンドバッファに追加します。
宣言
void appendCarriageReturn();
引数
なし
戻り値
なし
4.3.10. appendBitmap
added in version 1.6.0
グラフィック表示コマンドを生成し、コマンドバッファに追加します。
宣言
void appendBitmap(Bitmap bitmap, boolean diffusion);
引数
名称
説明
型
bitmap
表示したいイメージ横 160dot、縦 40dotのモノクロBitmapクラスのインスタンスを指定してください。異なるサイズのBitmapが指定された場合、横 160dot、縦 40dotにリサイズされます。Bitmapの各ピクセルの色は自動でモノクロ2値に変換されます。android.graphics.Bitmap
diffusion
誤差拡散true ... 誤差拡散を行うfalse ... 誤差拡散を行わないboolean
戻り値
なし
実装例
public static byte[] createGraphicPattern(int number, Resources resources) { IDisplayCommandBuilder builder = StarIoExt.createDisplayCommandBuilder(DisplayModel.SCD222); builder.appendClearScreen(); builder.appendCursorMode(CursorMode.Off); // builder.appendHomePosition(); Bitmap bitmap; switch (number) { default: case 0: bitmap = BitmapFactory.decodeResource(resources, R.drawable.display_image_1); break; case 1: bitmap = BitmapFactory.decodeResource(resources, R.drawable.display_image_2); break; case 2: bitmap = BitmapFactory.decodeResource(resources, R.drawable.display_image_3); break; case 3: bitmap = BitmapFactory.decodeResource(resources, R.drawable.display_image_4); break; } builder.appendBitmap(bitmap, false); return builder.getPassThroughCommands(); }
DisplayFunctions.javaを参照ください。
4.3.11. appendInternational
added in version 1.6.0
国際文字指定コマンドを生成し、コマンドバッファに追加します。
宣言
void appendInternational(InternationalType internationalType);
引数
名称
説明
型
internationalType
国際文字指定定数
戻り値
なし
実装例
public static byte[] createCharacterSet(InternationalType internationalType, CodePageType codePageType) { IDisplayCommandBuilder builder = StarIoExt.createDisplayCommandBuilder(DisplayModel.SCD222); builder.appendClearScreen(); builder.appendCursorMode(CursorMode.Off); builder.appendHomePosition(); builder.appendInternational(internationalType); builder.appendCodePage(codePageType); ... switch (codePageType) { default: builder.append(pattern1); break; // CP437,Katakana,CP850,CP860,CP863,CP865,CP1252,CP866,CP852,CP858 case Japanese: builder.append(pattern2); break; case SimplifiedChinese: builder.append(pattern3); break; case TraditionalChinese: builder.append(pattern4); break; case Hangul: builder.append(pattern5); break; } return builder.getPassThroughCommands(); }
DisplayFunctions.javaを参照ください。
4.3.12. appendCodePage
added in version 1.6.0
コードページ指定コマンドを生成し、コマンドバッファに追加します。
宣言
void appendCodePage(CodePageType codePageType);
引数
名称
説明
型
codePageType
コードページ指定定数
戻り値
なし
実装例
public static byte[] createCharacterSet(InternationalType internationalType, CodePageType codePageType) { IDisplayCommandBuilder builder = StarIoExt.createDisplayCommandBuilder(DisplayModel.SCD222); builder.appendClearScreen(); builder.appendCursorMode(CursorMode.Off); builder.appendHomePosition(); builder.appendInternational(internationalType); builder.appendCodePage(codePageType); ... switch (codePageType) { default: builder.append(pattern1); break; // CP437,Katakana,CP850,CP860,CP863,CP865,CP1252,CP866,CP852,CP858 case Japanese: builder.append(pattern2); break; case SimplifiedChinese: builder.append(pattern3); break; case TraditionalChinese: builder.append(pattern4); break; case Hangul: builder.append(pattern5); break; } return builder.getPassThroughCommands(); }
DisplayFunctions.javaを参照ください。
4.3.13. appendDeleteToEndOfLine
added in version 1.6.0
画面を行末までクリアするコマンドを生成し、コマンドバッファに追加します。
宣言
void appendDeleteToEndOfLine();
引数
なし
戻り値
なし
4.3.14. appendClearScreen
added in version 1.6.0
画面をクリアするコマンドを生成し、コマンドバッファに追加します。
宣言
void appendClearScreen();
引数
なし
戻り値
なし
実装例
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.3.15. appendHomePosition
added in version 1.6.0
カーソルをホームポジションに移動するコマンドを生成し、コマンドバッファに追加します。
宣言
void appendHomePosition();
引数
なし
戻り値
なし
実装例
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.3.16. appendTurnOn
added in version 1.6.0
バックライトをオン・オフするコマンドを生成し、コマンドバッファに追加します。
宣言
void appendTurnOn(boolean turnOn);
引数
名称
説明
型
turnOn
バックライトのオン・オフ
boolean
戻り値
なし
実装例
public static byte[] createTurnOn(boolean isTurnOn) { IDisplayCommandBuilder builder = StarIoExt.createDisplayCommandBuilder(DisplayModel.SCD222); ... builder.appendTurnOn(isTurnOn); return builder.getPassThroughCommands(); }
DisplayFunctions.javaを参照ください。
4.3.17. appendSpecifiedPosition
added in version 1.6.0
カーソルを指定された位置に移動するコマンドを生成し、コマンドバッファに追加します。
宣言
void appendSpecifiedPosition(int x, int y);
引数
名称
説明
型
x
桁位置(一番左の桁が1)
int
y
行位置(一番上の行が1)
int
戻り値
なし
実装例
public static byte[] createCursorMode(CursorMode mode) { IDisplayCommandBuilder builder = StarIoExt.createDisplayCommandBuilder(DisplayModel.SCD222); builder.appendClearScreen(); builder.appendCursorMode(CursorMode.Off); builder.appendHomePosition(); byte[] pattern = {'S', 't', 'a', 'r', ' ', 'M', 'i', 'c', 'r', 'o', 'n', 'i', 'c', 's', ' ', ' ', ' ', ' ', ' ', ' ', 'T', 'o', 't', 'a', 'l', ' ', ':', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '1', '2', '3', '4', '5'}; builder.append(pattern); builder.appendSpecifiedPosition(20, 2); builder.appendCursorMode(mode); return builder.getPassThroughCommands(); }
DisplayFunctions.javaを参照ください。
4.3.18. appendCursorMode
added in version 1.6.0
カーソルモード変更コマンドを生成し、コマンドバッファに追加します。
宣言
void appendCursorMode(CursorMode cursorMode);
引数
名称
説明
型
cursorMode
カーソルモード指定定数
戻り値
なし
実装例
public static byte[] createCursorMode(CursorMode mode) { IDisplayCommandBuilder builder = StarIoExt.createDisplayCommandBuilder(DisplayModel.SCD222); builder.appendClearScreen(); builder.appendCursorMode(CursorMode.Off); builder.appendHomePosition(); byte[] pattern = {'S', 't', 'a', 'r', ' ', 'M', 'i', 'c', 'r', 'o', 'n', 'i', 'c', 's', ' ', ' ', ' ', ' ', ' ', ' ', 'T', 'o', 't', 'a', 'l', ' ', ':', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '1', '2', '3', '4', '5'}; builder.append(pattern); builder.appendSpecifiedPosition(20, 2); builder.appendCursorMode(mode); return builder.getPassThroughCommands(); }
DisplayFunctions.javaを参照ください。
4.3.19. appendContrastMode
added in version 1.6.0
コントラストモード変更コマンドを生成し、コマンドバッファに追加します。
宣言
void appendContrastMode(ContrastMode contrastMode);
引数
名称
説明
型
contrastMode
コントラストモード指定定数
戻り値
なし
実装例
public static byte[] createContrastMode(ContrastMode contrastMode) { IDisplayCommandBuilder builder = StarIoExt.createDisplayCommandBuilder(DisplayModel.SCD222); // builder.appendClearScreen(); // builder.appendCursorMode(CursorMode.Off); // builder.appendHomePosition(); // // byte[] pattern = {'S', 't', 'a', 'r', ' ', 'M', 'i', 'c', 'r', 'o', 'n', 'i', 'c', 's', ' ', ' ', ' ', ' ', ' ', ' ', // ' ', ' ', ' ', ' ', ' ', ' ', ' ', 'S', 't', 'a', 'r', ' ', 'M', 'i', 'c', 'o', 'n', 'i', 'c', 's'}; // // builder.append(pattern); builder.appendContrastMode(contrastMode); return builder.getPassThroughCommands(); }
DisplayFunctions.javaを参照ください。
4.3.20. appendUserDefinedCharacter
added in version 1.6.0
ユーザー定義文字(SBCS)登録コマンドを生成し、コマンドバッファに追加します。
宣言
void appendUserDefinedCharacter(int index, int code, byte[] font);
引数
名称
説明
型
index
フォント番号00h ≦ index ≦ 1Fhint
code
ユーザー定義文字の文字コード20h ≦ code ≦ 7FhappendCodePage メソッドで Japanese を指定した場合、以下の範囲も使用可能です。A0h ≦ code ≦ DFhint
font
16byteのフォントデータユーザー定義文字のフォントデータのフォーマットを参照してください。null を指定すると、指定したフォント番号のユーザー定義文字を解除します。byte[]
戻り値
なし
ユーザー定義文字のフォントデータのフォーマット
実装例
public static byte[] createUserDefinedCharacter(boolean set) { IDisplayCommandBuilder builder = StarIoExt.createDisplayCommandBuilder(DisplayModel.SCD222); builder.appendClearScreen(); builder.appendCursorMode(CursorMode.Off); builder.appendHomePosition(); builder.appendInternational(InternationalType.USA); builder.appendCodePage(CodePageType.Japanese); if (set) { byte[] font = { (byte) 0x00, (byte) 0x00, (byte) 0x32, (byte) 0x00, (byte) 0x49, (byte) 0x00, (byte) 0x49, (byte) 0x7f, (byte) 0x26, (byte) 0x48, (byte) 0x00, (byte) 0x48, (byte) 0x00, (byte) 0x30, (byte) 0x00, (byte) 0x00 }; byte[] dbcsFont = { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x03, (byte) 0x20, (byte) 0x04, (byte) 0x90, (byte) 0x04, (byte) 0x90, (byte) 0x02, (byte) 0x60, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0xf0, (byte) 0x04, (byte) 0x80, (byte) 0x04, (byte) 0x80, (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 }; builder.appendUserDefinedCharacter(0, 0x20, font); builder.appendUserDefinedDbcsCharacter(0, 0x8140, dbcsFont); } else { builder.appendUserDefinedCharacter(0, 0x20, null); builder.appendUserDefinedDbcsCharacter(0, 0x8140, null); } byte[] pattern = { (byte) 0x5b,(byte) 0x20,(byte) 0x20,(byte) 0x53,(byte) 0x74,(byte) 0x61,(byte) 0x72,(byte) 0x20,(byte) 0x4d,(byte) 0x69,(byte) 0x63,(byte) 0x72,(byte) 0x6f,(byte) 0x6e,(byte) 0x69,(byte) 0x63,(byte) 0x73,(byte) 0x20,(byte) 0x20,(byte) 0x5d, (byte) 0x5b,(byte) 0x81,(byte) 0x40,(byte) 0x81,(byte) 0x40,(byte) 0x83,(byte) 0x58,(byte) 0x83,(byte) 0x5e,(byte) 0x81,(byte) 0x5b,(byte) 0x90,(byte) 0xb8,(byte) 0x96,(byte) 0xa7,(byte) 0x81,(byte) 0x40,(byte) 0x81,(byte) 0x40,(byte) 0x5d, }; builder.append(pattern); return builder.getPassThroughCommands(); }
DisplayFunctions.javaを参照ください。
4.3.21. appendUserDefinedDbcsCharacter
added in version 1.6.0
ユーザー定義文字(DBCS)登録コマンドを生成し、コマンドバッファに追加します。
宣言
void appendUserDefinedDbcsCharacter(int index, int code, byte[] font);
引数
名称
説明
型
index
フォント番号00h ≦ index ≦ 0Fhint
code
ユーザー定義文字の文字コード20h ≦ code ≦ 7FhappendCodePage メソッドで Japanese を指定した場合、以下の範囲も使用可能です。80 00h ≦ code ≦ FF FFhint
font
32byteのフォントデータユーザー定義文字のフォントデータのフォーマットを参照してください。null を指定すると、指定したフォント番号のユーザー定義文字を解除します。byte[]
戻り値
なし
ユーザー定義文字のフォントデータのフォーマット
実装例
public static byte[] createUserDefinedCharacter(boolean set) { IDisplayCommandBuilder builder = StarIoExt.createDisplayCommandBuilder(DisplayModel.SCD222); builder.appendClearScreen(); builder.appendCursorMode(CursorMode.Off); builder.appendHomePosition(); builder.appendInternational(InternationalType.USA); builder.appendCodePage(CodePageType.Japanese); if (set) { byte[] font = { (byte) 0x00, (byte) 0x00, (byte) 0x32, (byte) 0x00, (byte) 0x49, (byte) 0x00, (byte) 0x49, (byte) 0x7f, (byte) 0x26, (byte) 0x48, (byte) 0x00, (byte) 0x48, (byte) 0x00, (byte) 0x30, (byte) 0x00, (byte) 0x00 }; byte[] dbcsFont = { (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x03, (byte) 0x20, (byte) 0x04, (byte) 0x90, (byte) 0x04, (byte) 0x90, (byte) 0x02, (byte) 0x60, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0xf0, (byte) 0x04, (byte) 0x80, (byte) 0x04, (byte) 0x80, (byte) 0x03, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 }; builder.appendUserDefinedCharacter(0, 0x20, font); builder.appendUserDefinedDbcsCharacter(0, 0x8140, dbcsFont); } else { builder.appendUserDefinedCharacter(0, 0x20, null); builder.appendUserDefinedDbcsCharacter(0, 0x8140, null); } byte[] pattern = { (byte) 0x5b,(byte) 0x20,(byte) 0x20,(byte) 0x53,(byte) 0x74,(byte) 0x61,(byte) 0x72,(byte) 0x20,(byte) 0x4d,(byte) 0x69,(byte) 0x63,(byte) 0x72,(byte) 0x6f,(byte) 0x6e,(byte) 0x69,(byte) 0x63,(byte) 0x73,(byte) 0x20,(byte) 0x20,(byte) 0x5d, (byte) 0x5b,(byte) 0x81,(byte) 0x40,(byte) 0x81,(byte) 0x40,(byte) 0x83,(byte) 0x58,(byte) 0x83,(byte) 0x5e,(byte) 0x81,(byte) 0x5b,(byte) 0x90,(byte) 0xb8,(byte) 0x96,(byte) 0xa7,(byte) 0x81,(byte) 0x40,(byte) 0x81,(byte) 0x40,(byte) 0x5d, }; builder.append(pattern); return builder.getPassThroughCommands(); }
DisplayFunctions.javaを参照ください。
4.3.22. getCommands
added in version 1.6.0
コマンドバッファ(生成したコマンド)を取得します。
宣言
byte[] getCommands();
引数
なし
値
説明
型
コマンドバッファ(生成したコマンド)
byte[]
4.3.23. getPassThroughCommands
added in version 1.6.0
コマンドバッファ(生成したコマンド)の先頭にプリンタへのパススルーコマンドが追加されたコマンド列を取得します。
宣言
byte[] appendPassThroughCommands();
引数
なし
戻り値
説明
型
コマンドバッファ(生成したコマンド)
byte[]
実装例
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を参照ください。