3.5. StarBluetoothManager

Class to set Bluetooth settings

Warning

It can not be used with StarIOPort Class at the sime time.

Supported Method / Parameter for each model.

Model/Emulation

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

F/W Version 3.0 or later is required.

[2]

The SecurityType that can be set and acquired is PIN code or SSP.

[3]

The SecurityType that can be set and retrieved is PIN code or Disable.

[4]
Firmware version less than 5.0 : The SecurityType that can be set and retrieved is PIN code or Disable.
Firmware version 5.0 or later : The SecurityType that can be set and retrieved is PIN code, SSP, SSP Numeric Comparison or Disable.

3.5.1. Bluetooth setting change flow using StarBluetoothManager

Using the StarBluetoothManager class, follow the steps below to change the printer’s Bluetooth settings.

../_images/bluetooth_flow.png
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) {}
    }
}

Refer to BluetoothSettingFragment.java.

3.5.2. StarDeviceType

Constants of Printer Type.

  • Declaration

    public enum StarDeviceType {
        StarDeviceTypeDesktopPrinter,
        StarDeviceTypePortablePrinter
    }
    
  • Constants

    Name

    Contents

    StarDeviceTypeDesktopPrinter

    Desktop Printer

    StarDeviceTypePortablePrinter

    Portable Printer

Constant for each model.

Model

Emulation

Constants

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

Constants of Bluetooth security type.

  • Declaration

    public enum StarBluetoothSecurity {
        PINCODE,
        SSP,
        SSP_NUMERIC_COMPARISON,
        DISABLE
    }
    
  • Constants

    Name

    Contents

    PINCODE

    Security by entering PIN code

    SSP

    Interface card model : Security by pressing the interface card button
    Others : No additional operations

    SSP_NUMERIC_COMPARISON

    Confirm that the authentication code displayed on the printer display or printed from the printer matches

    DISABLE

    No security

3.5.4. StarBluetoothSettingCapability

Constants of enable / disable information of the Bluetooth setting.

  • Declaration

    public enum StarBluetoothSecurity {
        SUPPORT,
        NOSUPPORT
    }
    
  • Constants

    Name

    Contents

    SUPPORT

    Indicates the items and functions can be set for the printer that is currently connected.

    NOSUPPORT

    Indicates the items and functions can not be set for the printer that is currently connected.

3.5.5. StarBluetoothManager

Creates the instance.

  • Declaration

    StarBluetoothManager(String portName, String portSetting, int ioTimeoutMillis, StarBluetoothManager.StarDeviceType starDeviceType);
    
  • Parameter

    Parameter

    Contents

    Type

    portName

    It is the same as the portName of the getPort method.

    String

    portSettings

    It is the same as the portSetting of the getPort method.

    String

    ioTimeoutMillis

    Timeout value for internal control and API.

    int

    starDeviceType

    Constants of Printer Type

    StarDeviceType

    Refer to StarDeviceType constant.

  • Return value

    Contents

    Type

    StarBluetoothManager object

    StarBluetoothManager

Refer to Bluetooth setting change flow using StarBluetoothManager about the procedure of change the Bluetooth Setting.

Note

StarBluetoothManagerFactory included in starioextension.aar can get the appropriate StarBluetoothManager object for the printer emulation.

3.5.6. open

Opens a port for communicating with the printer.

Important

Get the current settings by loadSetting method after conducting open method.

  • Declaration

    public void open();
    
  • Parameter

    None

  • Return value

    None

Refer to Bluetooth setting change flow using StarBluetoothManager about the procedure of change the Bluetooth Setting.

3.5.7. loadSetting

Gets the value specified from the printer.

  • Declaration

    public void loadSetting();
    
  • Parameter

    None

  • Return value

    None

Refer to Bluetooth setting change flow using StarBluetoothManager about the procedure of change the Bluetooth Setting.

3.5.8. close

Closes a port for communicating with the printer.

  • Declaration

    public void close();
    
  • Parameter

    None

  • Return value

    None

Refer to Bluetooth setting change flow using StarBluetoothManager about the procedure of change the Bluetooth Setting.

3.5.9. apply

Set the value specified by the following methods to the printer.

  • Declaration

    public void apply();
    
  • Parameter

    None

  • Return value

    None

Refer to Bluetooth setting change flow using StarBluetoothManager about the procedure of change the Bluetooth Setting.

3.5.10. getBluetoothDeviceNameCapability

The setting enable / disable information of the Bluetooth device name.

  • Declaration

    public StarBluetoothManager.StarBluetoothSettingCapability getBluetoothDeviceNameCapability();
    
  • Parameter

    None

3.5.11. getBluetoothDeviceName

The Bluetooth device name.

  • Declaration

    public String getBluetoothDeviceName();
    
  • Parameter

    None

  • Return value

    Contents

    Type

    Bluetooth device name

    String

3.5.12. setBluetoothDeviceName

This method sets the Bluetooth device name.

To change the iOS port name, execute the apply method after the this method.

  • Declaration

    public void setBluetoothDeviceName(String bluetoothDeviceName);
    
  • Parameter

    Name

    Contents

    Type

    bluetoothDeviceName

    Bluetooth device name

    String

  • Return value

    None

  • Exception

    Contents

    Type

    when any invalid characters are used
    when the length of the set character string is not valid number of characters

    StarIOPortException

  1. Valid characters

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

  2. Valid number of characters

    between 1 to 16 characters

3.5.13. getiOSPortNameCapability

The setting enable / disable information of the iOSPort name.

  • Declaration

    public StarBluetoothManager.StarBluetoothSettingCapability getiOSPortName();
    
  • Parameter

    None

3.5.14. getiOSPortName

Acquires and specifies the iOS port name to be used with the StarIO for Bluetooth communication.

  • Declaration

    public String getiOSPortName();
    
  • Parameter

    None

  • Return value

    Contents

    Type

    iOS Port Name

    String

3.5.15. setiOSPortName

This method sets the iOS port name.

To change the iOS port name, execute the apply method after the this method.

  • Declaration

    public void setiOSPortName(String iOSPortName);
    
  • Parameter

    Name

    Contents

    Type

    iOSPortName

    iOS Port Name

    String

  • Return value

    None

  • Exception

    Contents

    Type

    when any invalid characters are used
    when the length of the set character string is not valid number of characters

    StarIOPortException

  1. Valid characters

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

  2. Valid number of characters

    between 1 to 16 characters

3.5.16. getPinCodeCapability

The setting enable / disable information of the PIN code.

  • Declaration

    public StarBluetoothManager.StarBluetoothSettingCapability getPinCodeCapability();
    
  • Parameter

    None

3.5.17. getPinCode

The PIN code.

  • Declaration

    public String getPinCode();
    
  • Parameter

    None

  • Return value

    Contents

    Type

    Pin Code

    String

3.5.18. setPinCode

This method sets the PIN code.

To change the PIN Code, execute the apply method after the this method.

  • Declaration

    public void setPinCode(String pinCode);
    
  • Parameter

    Name

    Contents

    Type

    pinCode

    Pin Code

    String

  • Return value

    None

  • Exception

    Contents

    Type

    when any invalid characters are used
    when the length of the set character string is not valid number of characters

    StarIOPortException

  1. Valid characters

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

    • 0-9 a-z A-Z (other models)

  2. Valid number of characters

    • 4 characters (SM-L200, SM-L300)

    • between 4 to 16 characters (other models)

3.5.19. getAutoConnectCapability

The setting enable / disable information of the AutoConnection.

  • Declaration

    public StarBluetoothManager.StarBluetoothSettingCapability getAutoConnectCapability();
    
  • Parameter

    None

3.5.20. getAutoConnect

Acquires and specifies the setting of the auto connection function.

  • Declaration

    public boolean getAutoConnect();
    
  • Parameter

    None

  • Return value

    Contents

    Type

    AutoConnection setting
    true … when AutoConnection setting is ON
    false … when AutoConnection setting is OFF

    boolean

3.5.21. setAutoConnect

Sets the Auto Connection.

To change the Auto Connection, execute the apply method after the this method.

  • Declaration

    public void setAutoConnect(boolean autoConnect);
    
  • Parameter

    Name

    Contents

    Type

    autoConnect

    AutoConnection setting
    true … when AutoConnection setting is ON
    false … when AutoConnection setting is OFF

    boolean

  • Return value

    None

3.5.22. getSecurityTypeCapability

The setting enable / disable information of the Bluetooth security type.

  • Declaration

    public StarBluetoothManager.StarBluetoothSettingCapability getSecurityTypeCapability();
    
  • Parameter

    None

3.5.23. getSecurityType

Acquires and specifies the Bluetooth security setting.

  • Declaration

    public StarBluetoothManager.StarBluetoothSecurity getSecurityType();
    
  • Parameter

    None

3.5.24. setSecurityType

Sets the Bluetooth security type.

To change the Bluetooth security type, execute the apply method after the this method.

  • Declaration

    public void setSecurityType(StarBluetoothManager.StarBluetoothSecurity securityType);
    
  • Parameter

    Name

    Contents

    Type

    securityType

    Bluetooth security type

    StarBluetoothSecurity

  • Return value

    None

3.5.25. getPortName

This method gets the port name specified by the constructor.

  • Declaration

    public String getPortName();
    
  • Parameter

    None

  • Return value

    Contents

    Type

    portName specified by the constructor

    String

3.5.26. getPortSettings

This method gets the port setting specified by the constructor.

  • Declaration

    public String getPortSettings();
    
  • Parameter

    None

  • Return value

    Contents

    Type

    portSettings specified by constructor

    String

3.5.27. getTimeoutMillis

This method gets the TimeoutMillis specified by the constructor.

  • Declaration

    public int getTimeoutMillis();
    
  • Parameter

    None

  • Return value

    Contents

    Type

    ioTimeoutMillis specified by the constructor

    int

3.5.28. getDeviceType

The type of the printer to be connected.

  • Declaration

    public StarBluetoothManager.StarDeviceType getDeviceType();
    
  • Parameter

    None

  • Return value

    Contents

    Type

    deviceType specified by the constructor

    StarDeviceType

3.5.29. isOpened

Shows whether the port is opened.

  • Declaration

    public boolean isOpened();
    
  • Parameter

    None

  • Return value

    Contents

    Type

    port status
    true … The port is opened
    false … The port is closed

    boolean