3.8. StarBluetoothManager

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

警告

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

  • メソッド

    名称

    説明

    Open

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

    LoadSetting

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

    Close

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

    Apply

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

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

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

mC-Print2 mC-Print3 mC-Label2 mC-Label3 mPOP FVP10 TSP100IV TSP100IIIW TSP100IIIBITSP100IIIU TSP100IIU+ TSP100ECO TSP100U TSP100GTTSP100LAN TSP650II TSP650IISK TSP700II TSP800IISM-S210i SM-S220i SM-S230i SM-T300i/T300 SM-T400i BSC10 SM-L200 SM-L300 SP700
StarPRNT StarPRNT StarPRNT StarPRNT StarPRNT StarLine StarPRNT StarGraphic StarGraphic StarGraphic StarGraphic StarGraphic 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

Open

- - - - - - - -

LoadSetting

- - - - - - - -

Close

- - - - - - - -

Apply

- - - - - - - -

BluetoothDeviceNameCapability

- - - - - - - -

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.8.1. Bluetooth設定変更フロー

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

../_images/bluetooth_flow.png
StarBluetoothManager bluetoothManager = StarBluetoothManagerFactory.GetManager("BT:COM1", "", 10000, Emulation.StarLine)

try
{
    // Port open
    bluetoothManager.Open();

    // Get Bluetooth Settings
    bluetoothManager.LoadSetting();

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

   // Apply Bluetooth settings
     bluetoothManager.Apply();
}
catch(PortException)
{
    // Error
}
finally
{
    // Port close
    bluetoothManager.Close():
}

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

3.8.2. StarDeviceType

プリンタタイプを示す定数です。

  • 宣言

    public enum StarDeviceType {
        StarDeviceTypeDesktopPrinter,
        StarDeviceTypePortablePrinter
    }
    
  • 定数

    名称

    説明

    StarDeviceTypeDesktopPrinter

    デスクトッププリンタ

    StarDeviceTypePortablePrinter

    モバイルプリンタ

各モデルに対して適用すべき定数は以下のとおりです。

モデル

エミュレーション

定数

mC-Print2 StarPRNT

StarDeviceTypePortablePrinter

mC-Print3 StarPRNT

StarDeviceTypePortablePrinter

mC-Label2 StarPRNT

StarDeviceTypePortablePrinter

mC-Label3 StarPRNT

StarDeviceTypePortablePrinter

mPOP StarPRNT

StarDeviceTypePortablePrinter

FVP10 StarLine

StarDeviceTypeDesktopPrinter

TSP100IV StarPRNT

StarDeviceTypePortablePrinter

TSP100IV SK StarPRNT

StarDeviceTypePortablePrinter

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.8.3. StarBluetoothSecurity

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

  • 宣言

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

    名称

    説明

    PINCODE

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

    SSP

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

    DISABLE

    セキュリティなし

3.8.4. StarBluetoothSettingCapability

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

  • 宣言

    public enum StarBluetoothSettingCapability {
        SUPPORT,
        NOSUPPORT
    }
    
  • 定数

    名称

    説明

    SUPPORT

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

    NOSUPPORT

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

3.8.5. BluetoothDeviceNameCapability

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

  • 宣言

    public StarBluetoothSettingCapability BluetoothDeviceNameCapability { get; }
    

3.8.6. BluetoothDeviceName

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

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

  1. 使用可能文字

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

  2. 文字数制限

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

  • 宣言

    public string BluetoothDeviceName { get; set; }
    

3.8.7. iOSPortNameCapability

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

  • 宣言

    public StarBluetoothSettingCapability iOSPortNameCapability { get; }
    

3.8.8. iOSPortName

iOSポート名を示します。

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

  1. 使用可能文字

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

  2. 文字数制限

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

  • 宣言

    public string iOSPortName { get; set; }
    

3.8.9. PinCodeCapability

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

  • 宣言

    public StarBluetoothSettingCapability PinCodeCapability { get; }
    

3.8.10. PinCode

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

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

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

  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.8.11. AutoConnectCapability

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

  • 宣言

    public StarBluetoothSettingCapability AutoConnectCapability { get; }
    

3.8.12. AutoConnect

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

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

  • 宣言

    public bool AutoConnect { get; set; }
    

3.8.13. SecurityTypeCapability

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

  • 宣言

    public StarBluetoothSettingCapability SecurityTypeCapability { get; }
    

3.8.14. SecurityType

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

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

  • 宣言

    public StarBluetoothSecurity SecurityType { get; set; }
    

3.8.15. PortName

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

  • 宣言

    public string PortName { get; }
    

3.8.16. PortSettings

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

  • 宣言

    public string PortSettings { get; }
    

3.8.17. Timeout

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

  • 宣言

    public int TimeoutMillis { get; }
    

3.8.18. DeviceType

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

  • 宣言

    public StarDeviceType DeviceType { get; }
    

3.8.19. isOpened

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

  • 宣言

    public bool IsOpened
    

3.8.20. StarBluetoothManager

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

  • 宣言

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

    引数

    説明

    portName

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

    string

    portSettings

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

    string

    ioTimeoutMillis

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

    int

    starDeviceType

    プリンタータイプ定数

    StarDeviceType

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

  • 戻り値

    説明

    StarBluetoothManager オブジェクト

    StarBluetoothManager

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

注釈

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

3.8.21. Open

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

重要

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

  • 宣言

    public void Open()
    
  • 引数

    なし

  • 戻り値

    なし

  • 例外

    説明

    通信エラーが発生したとき

    PortException

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

3.8.22. LoadSetting

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

  • 宣言

    public void LoadSetting()
    
  • 引数

    なし

  • 戻り値

    なし

  • 例外

    説明

    通信エラーが発生したとき

    PortException

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

3.8.23. Close

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

  • 宣言

    public void Close()
    
  • 引数

    なし

  • 戻り値

    なし

  • 例外

    説明

    通信エラーが発生したとき

    PortException

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

3.8.24. Apply

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

  • 宣言

    public void Apply()
    
  • 引数

    なし

  • 戻り値

    なし

  • 例外

    説明

    通信エラーが発生したとき

    PortException

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