3.4. SMBluetoothManager

Class to set Bluetooth settings

Warning

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

  • Method

    Name

    Contents

    open

    Opens a port for communicating with the printer.

    loadSetting

    Gets the value specified from the printer.

    close

    Closes a port for communicating with the printer.

    apply

    Set the specified value to the printer

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 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 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

- - - - - - - -

deviceNameCapability

- - - - - - - -

deviceName

- - - - - - - -

iOSPortNameCapability

- - - - - - - -

iOSPortName

- - - - - - - - - -

pinCodeCapability

- - - - - - - -

pinCode

- - - - - - - - - - - - - -

autoConnectCapability

- - - - - - - -

autoConnect

- - - - - - - - - -

securityTypeCapability

- - - - - - - -

security

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

portName

- - - - - - - -

portSettings

- - - - - - - -

timeoutMillis

- - - - - - - -

deviceType

- - - - - - - -

opened

- - - - - - - -
[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.4.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
// get SMBluetoothManager
SMBluetoothManager *bluetoothManager = [SMBluetoothManagerFactory getManager:portName
                                                                    emulation:emulation];

// Open port
if ([bluetoothManager open] == NO) {
    // Fail to open port.
    return;
}

// Load Bluetooth settings
if ([bluetoothManager loadSetting] == NO) {
    // Fail to load settings.
    [bluetoothManager close];

    return;
}

// Set Bluetooth settings
// Example: set "Star Micronics" to the deviceName.
bluetoothManager.deviceName = @"Star Micronics";

// Apply Bluetooth settings
if ([bluetoothManager apply] == NO) {

    // Fail to apply settings.
    [bluetoothManager close];

    return;
}

// Close port
[bluetoothManager close];

Refer to BluetoothSettingViewController.m.

3.4.2. SMDeviceType

Constants of Printer Type.

  • Declaration

    typedef enum _SMDeviceType {
        SMDeviceTypeDesktopPrinter,
        SMDeviceTypePortablePrinter,
    } SMDeviceType;
    
  • Constants

    Name

    Contents

    SMDeviceTypeDesktopPrinter

    Desktop Printer

    SMDeviceTypePortablePrinter

    Portable Printer

Constant for each model.

Model

Emulation

Constants

mC-Print2 StarPRNT

SMDeviceTypePortablePrinter

mC-Print3 StarPRNT

SMDeviceTypePortablePrinter

mC-Label3 StarPRNT

SMDeviceTypePortablePrinter

mPOP StarPRNT

SMDeviceTypePortablePrinter

FVP10 StarLine

SMDeviceTypeDesktopPrinter

TSP100IV StarPRNT

SMDeviceTypePortablePrinter

TSP100IV SK StarPRNT

SMDeviceTypePortablePrinter

TSP100IIIBI StarGraphic

SMDeviceTypeDesktopPrinter

TSP650II StarLine

SMDeviceTypeDesktopPrinter

TSP650IISK StarLine

SMDeviceTypeDesktopPrinter

TSP700II StarLine

SMDeviceTypeDesktopPrinter

TSP800II StarLine

SMDeviceTypeDesktopPrinter

SM-S210i StarPRNT

SMDeviceTypePortablePrinter

EscPosMobile
SM-S220i StarPRNT

SMDeviceTypePortablePrinter

EscPosMobile
SM-S230i StarPRNT

SMDeviceTypePortablePrinter

EscPosMobile
SM-T300i/T300 StarPRNT

SMDeviceTypePortablePrinter

EscPosMobile
SM-T400i StarPRNT

SMDeviceTypePortablePrinter

EscPosMobile
SM-L200 StarPRNT

SMDeviceTypePortablePrinter

SM-L300 StarPRNT

SMDeviceTypePortablePrinter

SP700 StarDotImpact

SMDeviceTypeDesktopPrinter

3.4.3. SMBluetoothSecurity

Constants of Bluetooth security type.

  • Declaration

    typedef enum _SMBluetoothSecurity {
        SMBluetoothSecurityDisable,
        SMBluetoothSecuritySSP,
        SMBluetoothSecuritySSPNumericComparison,
        SMBluetoothSecurityPINcode
    } SMBluetoothSecurity;
    
  • Constants

    Name

    Contents

    SMBluetoothSecurityPINcode

    Security by entering PIN code

    SMBluetoothSecuritySSP

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

    SMBluetoothSecuritySSPNumericComparison

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

    SMBluetoothSecurityDisable

    No security

3.4.4. SMBluetoothSettingCapability

Constants of enable / disable information of the Bluetooth setting.

  • Declaration

    typedef enum _SMBluetoothSettingCapability {
        SMBluetoothSettingCapabilitySupport,
        SMBluetoothSettingCapabilityNoSupport
    } SMBluetoothSettingCapability;
    
  • Constants

    Name

    Contents

    SMBluetoothSettingCapabilitySupport

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

    SMBluetoothSettingCapabilityNoSupport

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

3.4.5. portName

This method gets the port name specified by the constructor.

  • Declaration

    @property (nonatomic, readonly) NSString *portName;
    

3.4.6. deviceType

The type of the printer to be connected.

  • Declaration

    @property(nonatomic, readonly) SMDeviceType deviceType;
    

3.4.7. opened

Shows whether the port is opened.

  • Declaration

    @property(nonatomic, readonly) BOOL opened;
    

3.4.8. deviceName

The Bluetooth device name.

To change setting, execute the apply method after this property changed.

  1. Valid characters

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

  2. Valid number of characters

    between 1 to 16 characters

  1. Notes

    In case of Bluetooth Low Energy, the changed Bluetooth names are effective after turning the device off and on and connecting again.

  • Declaration

    @property(nonatomic, retain) NSString *deviceName;
    

3.4.9. iOSPortName

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

To change setting, execute the apply method after this property changed.

  1. Valid characters

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

  2. Valid number of characters

    between 1 to 16 characters

  • Declaration

    @property(nonatomic, retain) NSString *iOSPortName;
    

3.4.10. autoConnect

Acquires and specifies the setting of the auto connection function.

To change setting, execute the apply method after this property changed.

  • Declaration

    @property(nonatomic, assign) BOOL autoConnect;
    

3.4.11. security

Acquires and specifies the Bluetooth security setting.

To change setting, execute the apply method after this property changed.

  • Declaration

    @property(nonatomic, assign) SMBluetoothSecurity security;
    

3.4.12. pinCode

The PIN code.

It is not possible to acquire the current setting value.

To change setting, execute the apply method after this property changed.

  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)

  • Declaration

    @property(nonatomic, retain) NSString *pinCode;
    

3.4.13. deviceNameCapability

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

  • Declaration

    @property (assign, readonly) SMBluetoothSettingCapability deviceNameCapability;
    

3.4.14. iOSPortNameCapability

The setting enable / disable information of the iOSPort name.

  • Declaration

    @property (assign, readonly) SMBluetoothSettingCapability iOSPortNameCapability;
    

3.4.15. autoConnectCapability

The setting enable / disable information of the AutoConnection.

  • Declaration

    @property (assign, readonly) SMBluetoothSettingCapability autoConnectCapability;
    

3.4.16. securityTypeCapability

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

  • Declaration

    @property (assign, readonly) SMBluetoothSettingCapability securityTypeCapability;
    

3.4.17. pinCodeCapability

The setting enable / disable information of the PIN code.

  • Declaration

    @property (assign, readonly) SMBluetoothSettingCapability pinCodeCapability;
    

3.4.18. initWithName

Creates the instance.

  • Declaration

    -(id) initWithPortName:(NSString *)portName deviceType:(SMDeviceType)deviceType;
    
  • Parameter

    Parameter

    Contents

    Type

    portName

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

    NSString *

    deviceType

    Constants of Printer Type

    SMDeviceType

  • Return value

    Contents

    Type

    SMBluetoothManager object
    It returns nil when failed.

    SMBluetoothManager

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

Note

SMBluetoothManagerFactory included in StarIO_Extension.xcframework can get the appropriate SMBluetoothManager object for the printer emulation.

3.4.19. open

Opens a port for communicating with the printer.

Important

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

  • Declaration

    - (BOOL) open;
    
  • Parameter

    None

  • Return value

    Contents

    Type

    succeeded or failure

    BOOL

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

3.4.20. loadSetting

Gets the value specified from the printer.

  • Declaration

    - (BOOL) loadSetting;
    
  • Parameter

    None

  • Return value

    Contents

    Type

    succeeded or failure

    BOOL

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

3.4.21. close

Closes a port for communicating with the printer.

  • Declaration

    - (void) close;
    
  • Parameter

    None

  • Return value

    None

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

3.4.22. apply

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

  • Declaration

    - (BOOL) apply;
    
  • Parameter

    None

  • Return value

    Contents

    Type

    succeeded or failure

    BOOL

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