3.9. StarBluetoothManager

Bluetoothインターフェイスの各種設定を行うためのクラスです。

警告

Port クラスと同時に使用しないでください。

  • メソッド

    名称

    説明

    ConnectAsync

    プリンターと通信するためのポートをオープンします。

    LoadSettingAsync

    接続したプリンターから設定を取得します。

    DisconnectAsync

    プリンターと通信するためのポートをクローズします。

    ApplyAsync

    プリンターに指定した値を設定します。

各モデルにおいて機能するメソッド/パラメータは以下のとおりです。

モデル/エミュレーション

mC-Print2 mC-Print3 mC-Label3 mPOP FVP10 TSP100IV TSP100IIIW TSP100IIIBITSP100LAN TSP650II TSP650IISK TSP700II TSP800IISM-S210i SM-S220i SM-S230i SM-T300i/T300 SM-T400i BSC10 SM-L200 SM-L300 SP700
StarPRNT StarPRNT StarPRNT StarPRNT StarLine StarPRNT StarGraphic StarGraphic StarGraphic StarLine StarLine StarLine StarLine StarPRNT EscPosMobile[1] StarPRNT EscPosMobile[1] StarPRNT EscPosMobile[1] StarPRNT EscPosMobile[1] StarPRNT EscPosMobile[1] EscPos StarPRNT StarPRNT StarDotImpact

ConnectAsync

- - - -

LoadSettingAsync

- - - -

DisconnectAsync

- - - -

ApplyAsync

- - - -

DeviceNameCapability

- - - -

BluetoothDeviceName

- - - -

iOSPortNameCapability

- - - -

iOSPortName

- - - - - -

PinCodeCapability

- - - -

PinCode

- - - - - - - - -

AutoConnectCapability

- - - -

AutoConnect

- - - - - -

SecurityTypeCapability

- - - -

SecurityType

- - - - [2] - - - - [2] [2] [2] [2] [3] [3] [3] [3] [3] [3] [3] [3] [3] [3] - [3] [3] [2]

PortName

- - - -

PortSettings

- - - -

Timeout

- - - -

DeviceType

- - - -

isOpened

- - - -
[1]

ファームウェアバージョン3.0以降が必要です

[2]

設定・取得できるSecurityTypeはPINコードもしくはSSP

[3]

設定・取得できるSecurityTypeはPINコードもしくはDisable

3.9.1. Bluetooth設定変更フロー

StarBluetoothManagerクラスを利用し、以下の手順に沿ってプリンタのBluetooth設定を変更します。

../_images/bluetooth_flow.png
StarBluetoothManager starBluetoothManager = null;

try {
    // Get the StarBluetoothManager
    starBluetoothManager = StarBluetoothManagerFactory.GetManager(portName, portSettings, 30000, emulation);

    // Port open
    await starBluetoothManager.ConnectAsync();

    // Get Bluetooth Settings
    await starBluetoothManager.LoadSettingAsync();

    // Set of Bluetooth settings
    // Example) When setting the device name to "Star Micronics"
    starBluetoothManager.BluetoothDeviceName = "Star Micronics";

    // Apply Bluetooth settings
    await starBluetoothManager.ApplyAsync();
}
catch (Exception ex) {
    // Error
}
finally {
    if (starBluetoothManager.IsOpened) {
        try {
        // Port close
        await starBluetoothManager.DisconnectAsync();
        }
        catch (Exception ex) {}
    }
}

BluetoothSettingsSample.xaml.csを参照ください。

3.9.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.9.3. StarBluetoothSecurity

Bluetoothセキュリティタイプを示す定数です。

  • 宣言

    public enum StarBluetoothSecurity {
        PINCODE,
        SSP,
        DISABLE
    }
    
  • 定数

    名称

    説明

    PINCODE

    PINコード入力によるセキュリティ

    SSP

    インターフェイスカードのボタン押下によるセキュリティ

    DISABLE

    セキュリティなし

3.9.4. StarBluetoothSettingCapability

Bluetooth設定可否を示す定数です。

  • 宣言

    public enum StarBluetoothSettingCapability {
        SUPPORT,
        NOSUPPORT
    }
    
  • 定数

    名称

    説明

    SUPPORT

    現在接続中のプリンタではその項目・機能が設定できることを示します。

    NOSUPPORT

    現在接続中のプリンタではその項目・機能が設定できないことを示します。

3.9.5. DeviceNameCapability

Bluetoothデバイス名の設定可否情報を示します。

  • 宣言

    public StarBluetoothSettingCapability DeviceNameCapability { get; }
    

3.9.6. BluetoothDeviceName

Bluetoothデバイス名を示します。

設定するためには、本プロパティを変更後に ApplyAsync メソッドを実行します。

  1. 使用可能文字

    0-9 a-z A-Z ; : ! ? # $ % & , . @ _ - = Space / * + ~ ^ [ { ( ] } ) | \

  2. 文字数制限

    1文字以上 かつ 16文字以下

  • 宣言

    public string BluetoothDeviceName { get; set; }
    

3.9.7. iOSPortNameCapability

iOSポート名の設定可否情報を示します。

  • 宣言

    public StarBluetoothSettingCapability iOSPortNameCapability { get; }
    

3.9.8. iOSPortName

iOSポート名を示します。

設定するには、本プロパティを変更後 ApplyAsync メソッドを実行します。

  1. 使用可能文字

    0-9 a-z A-Z ; : ! ? # $ % & , . @ _ - = Space / * + ~ ^ [ { ( ] } ) | \

  2. 文字数制限

    1文字以上 かつ 16文字以下

  • 宣言

    public string iOSPortName { get; set; }
    

3.9.9. PinCodeCapability

PINコード設定可否情報を示します。

  • 宣言

    public StarBluetoothSettingCapability PinCodeCapability { get; }
    

3.9.10. PinCode

Bluetoothペアリング時に使用するPINコードを示します。

現在の設定値を取得することはできません。

設定するには、本プロパティを変更後 ApplyAsync メソッドを実行します。

  1. 使用可能文字

    • 0-9 (SM-L200、SM-L300)

    • 0-9 a-z A-Z (その他のモデル)

  2. 文字数制限

    • 4文字 (SM-L200、SM-L300)

    • 4文字以上 かつ 16文字以下(その他のモデル)

  • 宣言

    public string PinCode { get; set; }
    

3.9.11. AutoConnectCapability

AutoConnectionの設定可否情報を示します。

  • 宣言

    public StarBluetoothSettingCapability AutoConnectCapability { get; }
    

3.9.12. AutoConnect

AutoConnection(自動接続機能)のオン/オフを示します。

設定するには、本プロパティを変更後 ApplyAsync メソッドを実行します。

  • 宣言

    public bool AutoConnect { get; set; }
    

3.9.13. SecurityTypeCapability

Bluetoothセキュリティタイプの設定可否情報を示します。

  • 宣言

    public StarBluetoothSettingCapability SecurityTypeCapability { get; }
    

3.9.14. SecurityType

Bluetoothセキュリティタイプを示します。

設定するには、本プロパティを変更後 ApplyAsync メソッドを実行します。

  • 宣言

    public StarBluetoothSecurity SecurityType { get; set; }
    

3.9.15. PortName

コンストラクタで指定したportNameを取得します。

  • 宣言

    public string PortName { get; }
    

3.9.16. PortSettings

コンストラクタで指定したportSettingsを取得します。

  • 宣言

    public string PortSettings { get; }
    

3.9.17. Timeout

コンストラクタで指定したioTimeoutMillisを取得します。

  • 宣言

    public Int32 Timeout { get; }
    

3.9.18. DeviceType

接続先プリンタの種類を示します。

  • 宣言

    public StarDeviceType DeviceType { get; }
    

3.9.19. isOpened

ポートがオープンされているかどうかを示します。

  • 宣言

    public bool IsOpened
    

3.9.20. StarBluetoothManager

インスタンスを生成します。

  • 宣言

    public StarBluetoothManager(string portName, string portSettings, int timeoutMillis, StarDeviceType starDeviceType)
    
  • 引数

    引数

    説明

    portName

    ConnectAsync メソッドのportNameと同じです。

    string

    portSettings

    ConnectAsync メソッドのportSettingと同じです。

    string

    ioTimeoutMillis

    内部制御および各APIのタイムアウト値

    int

    starDeviceType

    プリンタータイプ定数

    StarDeviceType

    各モデルに対して設定するstarDeviceType引数の値は、 StarDeviceType 定数を参照ください。

  • 戻り値

    説明

    StarBluetoothManager オブジェクト

    StarBluetoothManager

Bluetooth設定変更の手順は、 Bluetooth設定変更フロー を参照ください。

注釈

StarIO_Extension.winmd に含まれる StarBluetoothManagerFactory では、プリンタのエミュレーションに対して適切な StarBluetoothManager オブジェクトを取得することができます。

3.9.21. ConnectAsync

プリンターと通信するためのポートをオープンします。

重要

本メソッド実行後は、必ず LoadSettingAsync メソッドを実行し現在の設定を取得してください。

  • 宣言

    public IAsyncOperation<bool> ConnectAsync()
    
  • 引数

    なし

  • 戻り値

    説明

    成功・失敗

    bool

Bluetooth設定変更の手順は、 Bluetooth設定変更フロー を参照ください。

3.9.22. LoadSettingAsync

接続したプリンターから設定を取得します。

  • 宣言

    public IAsyncOperation<bool> LoadSettingAsync()
    
  • 引数

    なし

  • 戻り値

    説明

    成功・失敗

    bool

Bluetooth設定変更の手順は、 Bluetooth設定変更フロー を参照ください。

3.9.23. DisconnectAsync

プリンターと通信するためのポートをクローズします。

  • 宣言

    public IAsyncOperation<bool> DisconnectAsync()
    
  • 引数

    なし

  • 戻り値

    説明

    成功・失敗

    bool

Bluetooth設定変更の手順は、 Bluetooth設定変更フロー を参照ください。

3.9.24. ApplyAsync

以下メンバーで指定した値をプリンターに設定します。

  • 宣言

    public IAsyncOperation<bool> ApplyAsync()
    
  • 引数

    なし

  • 戻り値

    説明

    成功・失敗

    bool

Bluetooth設定変更の手順は、 Bluetooth設定変更フロー を参照ください。