3.5. StarBluetoothManager
Bluetoothインターフェイスの各種設定を行うためのクラスです。
警告
StarIOPort クラスと同時に使用しないでください。
列挙体
名称
説明
プリンタタイプ定数
Bluetoothセキュリティタイプ定数
Bluetooth設定可否定数
コンストラクタ
名称
説明
インスタンスを生成します。
メソッド
名称
説明
プリンターと通信するためのポートをオープンします。
接続したプリンターから設定を取得します。
プリンターと通信するためのポートをクローズします。
プリンターに指定した値を設定します。
Bluetoothデバイス名の設定可否情報を取得します。
Bluetoothデバイス名を取得します。
Bluetoothデバイス名を設定します。
iOSポート名の設定可否情報を取得します。
iOSポート名を取得します。
iOSポート名を設定します。
PINコード設定可否情報を取得します。
setPinCodeメソッドで設定したPINコードを取得します。
Bluetoothペアリング時に使用するPINコードを設定します。
AutoConnectionの設定可否情報を取得します。
AutoConnectionのオン/オフを取得します。
AutoConnectionのオン/オフを設定します。
Bluetoothセキュリティタイプの設定可否情報を取得します。
Bluetoothセキュリティタイプを取得します。
Bluetoothセキュリティタイプを設定します。
コンストラクタで指定したportNameを取得します。
コンストラクタで指定したportSettingsを取得します。
コンストラクタで指定したioTimeoutMillisを取得します。
コンストラクタで指定したdeviceTypeを取得します。
ポートの状態を取得します。
各モデルにおいて機能するメソッド/パラメータは以下のとおりです。
モデル/エミュレーション |
mC-Print2 | mC-Print3 | mC-Label3 | mPOP | FVP10 | TSP100IV | TSP100IIIW | TSP100IIIBI | TSP100IIIU | TSP100IIU+ | TSP100ECO | TSP100U | TSP100GT | TSP100LAN | TSP650II | TSP650IISK | TSP700II | TSP800II | TUP500 | SM-S210i | SM-S220i | SM-S230i | SM-T300i/T300 | SM-T400i | BSC10 | SM-L200 | SM-L300 | SP700 | SK1-211/221/V211 | SK1-211/221/V211 Presenter | SK1-311/321/V311 | SK1-311/V311 Presenter | |||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
StarPRNT | StarPRNT | StarPRNT | StarPRNT | StarLine | StarPRNT | StarGraphic | StarGraphic | StarGraphic | StarGraphic | StarGraphic | StarGraphic | StarGraphic | StarGraphic | StarLine | StarLine | StarLine | StarLine | StarLine | StarPRNT | EscPosMobile[1] | StarPRNT | EscPosMobile[1] | StarPRNT | EscPosMobile[1] | StarPRNT | EscPosMobile[1] | StarPRNT | EscPosMobile[1] | EscPos | StarPRNT | StarPRNT | StarDotImpact | StarPRNT | StarPRNT | StarPRNT | StarPRNT | |
open |
✔ | ✔ | ✔ | ✔ | ✔ | - | - | ✔ | - | - | - | - | - | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | - | - | - | - |
loadSetting |
✔ | ✔ | ✔ | ✔ | ✔ | - | - | ✔ | - | - | - | - | - | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | - | - | - | - |
close |
✔ | ✔ | ✔ | ✔ | ✔ | - | - | ✔ | - | - | - | - | - | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | - | - | - | - |
apply |
✔ | ✔ | ✔ | ✔ | ✔ | - | - | ✔ | - | - | - | - | - | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | - | - | - | - |
getBluetoothDeviceNameCapability |
✔ | ✔ | ✔ | ✔ | ✔ | - | - | ✔ | - | - | - | - | - | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | - | - | - | - |
getBluetoothDeviceName |
✔ | ✔ | ✔ | ✔ | ✔ | - | - | ✔ | - | - | - | - | - | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | - | - | - | - |
setBluetoothDeviceName |
✔ | ✔ | ✔ | ✔ | ✔ | - | - | ✔ | - | - | - | - | - | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | - | - | - | - |
getiOSPortNameCapability |
✔ | ✔ | ✔ | ✔ | ✔ | - | - | ✔ | - | - | - | - | - | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | - | - | - | - |
getiOSPortName |
✔ | ✔ | ✔ | ✔ | ✔ | - | - | ✔ | - | - | - | - | - | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | - | - | - | ✔ | - | - | - | - |
setiOSPortName |
✔ | ✔ | ✔ | ✔ | ✔ | - | - | ✔ | - | - | - | - | - | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | - | - | - | ✔ | - | - | - | - |
getPinCodeCapability |
✔ | ✔ | ✔ | ✔ | ✔ | - | - | ✔ | - | - | - | - | - | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | - | - | - | - |
getPinCode |
- | - | - | - | ✔ | - | - | - | - | - | - | - | - | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | - | - | - | - |
setPinCode |
- | - | - | - | ✔ | - | - | - | - | - | - | - | - | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | - | - | - | - |
getAutoConnectCapability |
✔ | ✔ | ✔ | ✔ | ✔ | - | - | ✔ | - | - | - | - | - | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | - | - | - | - |
getAutoConnect |
✔ | ✔ | ✔ | ✔ | ✔ | - | - | ✔ | - | - | - | - | - | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | - | - | - | ✔ | - | - | - | - |
setAutoConnect |
✔ | ✔ | ✔ | ✔ | ✔ | - | - | ✔ | - | - | - | - | - | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | - | - | - | ✔ | - | - | - | - |
getSecurityTypeCapability |
✔ | ✔ | ✔ | ✔ | ✔ | - | - | ✔ | - | - | - | - | - | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | - | - | - | - |
getSecurityType |
- | - | - | - | ✔[2] | - | - | - | - | - | - | - | - | - | ✔[2] | ✔[2] | ✔[2] | ✔[2] | - | ✔[4] | ✔[4] | ✔[3] | ✔[3] | ✔[4] | ✔[4] | ✔[4] | ✔[4] | ✔[4] | ✔[4] | - | ✔[3] | ✔[3] | ✔[2] | - | - | - | - |
setSecurityType |
- | - | - | - | ✔[2] | - | - | - | - | - | - | - | - | - | ✔[2] | ✔[2] | ✔[2] | ✔[2] | - | ✔[4] | ✔[4] | ✔[3] | ✔[3] | ✔[4] | ✔[4] | ✔[4] | ✔[4] | ✔[4] | ✔[4] | - | ✔[3] | ✔[3] | ✔[2] | - | - | - | - |
getPortName |
✔ | ✔ | ✔ | ✔ | ✔ | - | - | ✔ | - | - | - | - | - | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | - | - | - | - |
getPortSettings |
✔ | ✔ | ✔ | ✔ | ✔ | - | - | ✔ | - | - | - | - | - | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | - | - | - | - |
getTimeoutMillis |
✔ | ✔ | ✔ | ✔ | ✔ | - | - | ✔ | - | - | - | - | - | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | - | - | - | - |
getDeviceType |
✔ | ✔ | ✔ | ✔ | ✔ | - | - | ✔ | - | - | - | - | - | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | - | - | - | - |
isOpened |
✔ | ✔ | ✔ | ✔ | ✔ | - | - | ✔ | - | - | - | - | - | - | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ | - | ✔ | ✔ | ✔ | - | - | - | - |
[1] | ファームウェアバージョン3.0以降が必要です |
[2] | 設定・取得できるSecurityTypeはPINコードもしくはSSP |
[3] | 設定・取得できるSecurityTypeはPINコードもしくはDisable |
[4] | ファームウェアバージョン5.0未満 : 設定・取得できるSecurityTypeはPINコードもしくはDisable
ファームウェアバージョン5.0以降 : 設定・取得できるSecurityTypeはPINコード、SSP、SSP Numeric ComparisonもしくはDisable
|
3.5.1. Bluetooth設定変更フロー
StarBluetoothManagerクラスを利用し、以下の手順に沿ってプリンタのBluetooth設定を変更します。
StarBluetoothManager manager = null;
try {
// Get StarBluetoothManager
manager = StarBluetoothManagerFactory.getManager(portName, portSettings, 10000, emulation);
// Port open
manager.open();
// Loading Bluetooth settings
manager.loadSetting();
// Set Bluetooth settings
// Example) When setting the device name to "Star Micronics"
manager.setBluetoothDeviceName("Star Micronics");
// Apply Bluetooth settings
manager.apply();
}
catch (StarIOPortException e) {
// Error
}
finally {
if (manager.isOpened()) {
try {
// Port close
manager.close();
}
catch (StarIOPortException e) {}
}
}
BluetoothSettingFragment.java を参照ください。
3.5.2. StarDeviceType
プリンタタイプを示す定数です。
宣言
public enum StarDeviceType { StarDeviceTypeDesktopPrinter, StarDeviceTypePortablePrinter }
定数
名称
説明
StarDeviceTypeDesktopPrinter
デスクトッププリンタ
StarDeviceTypePortablePrinter
モバイルプリンタ
各モデルに対して適用すべき定数は以下のとおりです。
モデル |
エミュレーション |
定数 |
---|---|---|
mC-Print2 | StarPRNT | StarDeviceTypePortablePrinter |
mC-Print3 | StarPRNT | StarDeviceTypePortablePrinter |
mC-Label3 | StarPRNT | StarDeviceTypePortablePrinter |
mPOP | StarPRNT | StarDeviceTypePortablePrinter |
FVP10 | StarLine | StarDeviceTypeDesktopPrinter |
TSP100IIIBI | StarGraphic | StarDeviceTypeDesktopPrinter |
TSP650II | StarLine | StarDeviceTypeDesktopPrinter |
TSP650IISK | StarLine | StarDeviceTypeDesktopPrinter |
TSP700II | StarLine | StarDeviceTypeDesktopPrinter |
TSP800II | StarLine | StarDeviceTypeDesktopPrinter |
SM-S210i | StarPRNT | StarDeviceTypePortablePrinter |
EscPosMobile | ||
SM-S220i | StarPRNT | StarDeviceTypePortablePrinter |
EscPosMobile | ||
SM-S230i | StarPRNT | StarDeviceTypePortablePrinter |
EscPosMobile | ||
SM-T300i/T300 | StarPRNT | StarDeviceTypePortablePrinter |
EscPosMobile | ||
SM-T400i | StarPRNT | StarDeviceTypePortablePrinter |
EscPosMobile | ||
SM-L200 | StarPRNT | StarDeviceTypePortablePrinter |
SM-L300 | StarPRNT | StarDeviceTypePortablePrinter |
SP700 | StarDotImpact | StarDeviceTypeDesktopPrinter |
3.5.3. StarBluetoothSecurity
Bluetoothセキュリティタイプを示す定数です。
宣言
public enum StarBluetoothSecurity { PINCODE, SSP, SSP_NUMERIC_COMPARISON, DISABLE }
定数
名称
説明
PINCODE
PINコード入力によるセキュリティ
SSP
インターフェイスカード搭載機種:ボタン押下によるセキュリティそれ以外:追加操作なしSSP_NUMERIC_COMPARISON
プリンターのディスプレイに表示された認証コード、もしくはプリンターから印刷された認証コードとの一致を確認
DISABLE
セキュリティなし
3.5.4. StarBluetoothSettingCapability
Bluetooth設定可否を示す定数です。
宣言
public enum StarBluetoothSecurity { SUPPORT, NOSUPPORT }
定数
名称
説明
SUPPORT
現在接続中のプリンタではその項目・機能が設定できることを示します。
NOSUPPORT
現在接続中のプリンタではその項目・機能が設定できないことを示します。
3.5.5. StarBluetoothManager
インスタンスを生成します。
宣言
StarBluetoothManager(String portName, String portSetting, int ioTimeoutMillis, StarBluetoothManager.StarDeviceType starDeviceType);
引数
引数
説明
型
portName
getPort メソッドのportNameと同じです。
String
portSettings
getPort メソッドのportSettingと同じです。
String
ioTimeoutMillis
内部制御および各APIのタイムアウト値
int
starDeviceType
プリンタータイプ定数
各モデルに対して設定するstarDeviceType引数の値は、 StarDeviceType 定数を参照ください。
戻り値
説明
型
StarBluetoothManager オブジェクト
Bluetooth設定変更の手順は、 Bluetooth設定変更フロー を参照ください。
注釈
starioextension.aar に含まれる StarBluetoothManagerFactory では、プリンタのエミュレーションに対して適切な StarBluetoothManager オブジェクトを取得することができます。
3.5.6. open
プリンターと通信するためのポートをオープンします。
重要
本メソッド実行後は、必ず loadSetting メソッドを実行し現在の設定を取得してください。
宣言
public void open();
引数
なし
戻り値
なし
例外
説明
型
通信エラーが発生したとき
Bluetooth設定変更の手順は、 Bluetooth設定変更フロー を参照ください。
3.5.7. loadSetting
接続したプリンターから設定を取得します。
宣言
public void loadSetting();
引数
なし
戻り値
なし
例外
説明
型
通信エラーが発生したとき
Bluetooth設定変更の手順は、 Bluetooth設定変更フロー を参照ください。
3.5.8. close
プリンターと通信するためのポートをクローズします。
宣言
public void close();
引数
なし
戻り値
なし
例外
説明
型
通信エラーが発生したとき
Bluetooth設定変更の手順は、 Bluetooth設定変更フロー を参照ください。
3.5.9. apply
以下メンバーで指定した値をプリンターに設定します。
宣言
public void apply();
引数
なし
戻り値
なし
例外
説明
型
通信エラーが発生したとき
Bluetooth設定変更の手順は、 Bluetooth設定変更フロー を参照ください。
3.5.10. getBluetoothDeviceNameCapability
Bluetoothデバイス名の設定可否情報を示します。
宣言
public StarBluetoothManager.StarBluetoothSettingCapability getBluetoothDeviceNameCapability();
引数
なし
戻り値
説明
型
Bluetoothデバイス名の設定可否情報
3.5.11. getBluetoothDeviceName
Bluetoothデバイス名を示します。
宣言
public String getBluetoothDeviceName();
引数
なし
戻り値
説明
型
Bluetoothデバイス名
String
3.5.12. setBluetoothDeviceName
Bluetoothデバイス名を設定します。
Bluetoothデバイス名を変更するには、本メソッド後に apply メソッドを実行してください。
宣言
public void setBluetoothDeviceName(String bluetoothDeviceName);
引数
名称
説明
型
bluetoothDeviceName
Bluetoothデバイス名
String
戻り値
なし
例外
説明
型
使用可能文字以外を含む文字列を設定したとき文字数制限を満たさない文字列を設定したとき
使用可能文字
0-9 a-z A-Z ; : ! ? # $ % & , . @ _ - = Space / * + ~ ^ [ { ( ] } ) | \
文字数制限
1文字以上 かつ 16文字以下
3.5.13. getiOSPortNameCapability
iOSポート名の設定可否情報を示します。
宣言
public StarBluetoothManager.StarBluetoothSettingCapability getiOSPortName();
引数
なし
戻り値
説明
型
iOSポート名の設定可否情報
3.5.14. getiOSPortName
iOSポート名を示します。
宣言
public String getiOSPortName();
引数
なし
戻り値
説明
型
iOSポート名
String
3.5.15. setiOSPortName
iOSポート名を設定します。
iOSポート名を変更するには、本メソッド後に apply メソッドを実行してください。
宣言
public void setiOSPortName(String iOSPortName);
引数
名称
説明
型
iOSPortName
iOSポート名
String
戻り値
なし
例外
説明
型
使用可能文字以外を含む文字列を設定したとき文字数制限を満たさない文字列を設定したとき
使用可能文字
0-9 a-z A-Z ; : ! ? # $ % & , . @ _ - = Space / * + ~ ^ [ { ( ] } ) | \
文字数制限
1文字以上 かつ 16文字以下
3.5.16. getPinCodeCapability
PINコード設定可否情報を示します。
宣言
public StarBluetoothManager.StarBluetoothSettingCapability getPinCodeCapability();
引数
なし
戻り値
説明
型
PINコード設定可否情報
3.5.17. getPinCode
Bluetoothペアリング時に使用するPINコードを示します。
宣言
public String getPinCode();
引数
なし
戻り値
説明
型
PINコード
String
3.5.18. setPinCode
Bluetoothペアリング時に使用するPINコードを設定します。
PINコードを変更するには、本メソッド後に apply メソッドをを実行してください。
宣言
public void setPinCode(String pinCode);
引数
名称
説明
型
pinCode
PINコード
String
戻り値
なし
例外
説明
型
使用可能文字以外を含む文字列を設定したとき文字数制限を満たさない文字列を設定したとき
使用可能文字
0-9
(SM-L200、SM-L300)0-9 a-z A-Z
(その他のモデル)
文字数制限
4文字 (SM-L200、SM-L300)
4文字以上 かつ 16文字以下(その他のモデル)
3.5.19. getAutoConnectCapability
AutoConnectionの設定可否情報を示します。
宣言
public StarBluetoothManager.StarBluetoothSettingCapability getAutoConnectCapability();
引数
なし
戻り値
説明
型
AutoConnectionの設定可否情報
3.5.20. getAutoConnect
AutoConnection(自動接続機能)のオン/オフを示します。
宣言
public boolean getAutoConnect();
引数
なし
戻り値
説明
型
AutoConnection設定true
... AutoConnection設定がオンfalse
... AutoConnection設定がオフboolean
3.5.21. setAutoConnect
AutoConnectionを設定します。
AutoConnectionの設定を変更するには、本メソッド後に apply メソッドを実行してください。
宣言
public void setAutoConnect(boolean autoConnect);
引数
名称
説明
型
autoConnect
AutoConnection設定true
... AutoConnection設定をオンにするfalse
... AutoConnection設定をオフにするboolean
戻り値
なし
3.5.22. getSecurityTypeCapability
Bluetoothセキュリティタイプの設定可否情報を示します。
宣言
public StarBluetoothManager.StarBluetoothSettingCapability getSecurityTypeCapability();
引数
なし
戻り値
説明
型
Bluetoothセキュリティタイプの設定可否情報
3.5.23. getSecurityType
Bluetoothセキュリティタイプを示します。
宣言
public StarBluetoothManager.StarBluetoothSecurity getSecurityType();
引数
なし
戻り値
説明
型
Bluetoothセキュリティタイプ
3.5.24. setSecurityType
セキュリティタイプを設定します。
セキュリティタイプを変更するには、本メソッド後に apply メソッドを実行してください。
宣言
public void setSecurityType(StarBluetoothManager.StarBluetoothSecurity securityType);
引数
名称
説明
型
securityType
Bluetoothセキュリティタイプ
戻り値
なし
3.5.25. getPortName
コンストラクタで指定したportNameを取得します。
宣言
public String getPortName();
引数
なし
戻り値
説明
型
コンストラクタで指定したportName
String
3.5.26. getPortSettings
コンストラクタで指定したportSettingsを取得します。
宣言
public String getPortSettings();
引数
なし
戻り値
説明
型
コンストラクタで指定したportSettings
String
3.5.27. getTimeoutMillis
コンストラクタで指定したioTimeoutMillisを取得します。
宣言
public int getTimeoutMillis();
引数
なし
戻り値
説明
型
コンストラクタで指定したioTimeoutMillis
int
3.5.28. getDeviceType
接続先プリンタの種類を示します。
宣言
public StarBluetoothManager.StarDeviceType getDeviceType();
引数
なし
戻り値
説明
型
コンストラクタで指定したdeviceType
3.5.29. isOpened
ポートがオープンされているかどうかを示します。
宣言
public boolean isOpened();
引数
なし
戻り値
説明
型
ポートの状態true
... ポートがオープンされているfalse
... ポートがクローズされているboolean