5.1. StarNetworkManager

Class to set printer’s network settings.

  • Constructor

    Name

    Contents

    StarNetworkManager

    Creates the instance.

  • Method

    Name

    Contents

    load

    Gets the value specified from the printer.

    apply

    Set the specified value to the printer

Supported Method for each models.

Model/Emulation

mC-Print2 mC-Print3 mC-Label3
StarPRNT StarPRNT StarPRNT

load

apply

5.1.1. StarNetworkManager

Creates the instance.

  • Declaration

    StarNetworkManager(String portName, Context context) throws StarIODeviceSettingException;
    
  • Parameter

    Name

    Contents

    Type

    portName

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

    String

    context

    context

    android.content.Context

  • Return value

    Contents

    Type

    StarNetworkManager object

    StarNetworkManager

5.1.2. load

Gets the value specified from the printer.

  • Declaration

    public StarNetworkSetting load() throws StarIODeviceSettingException;
    
  • Parameter

    None

  • Return value

    Contents

    Type

    Network Settings

    StarNetworkSetting

  • Exception

    Contents

    Type

    When port open fails
    When an incorrect portName is passed
    when a communication failure occurs

    StarIODeviceSettingException

  • Examples

    scope.launch {
        try {
            val manager = StarNetworkManager(portNameEditText.text.toString(), baseContext)
    
            val result = manager.load()
    
        } catch (e: StarIODeviceSettingException) {
    
        }
    }
    

    Refer to StarIODeviceSettingSDK.

5.1.3. apply

added in version 1.0.0

Set the specified value to the printer

Important

The printer is reset after this method was executed.

  • Declaration

    public void apply(StarNetworkSetting setting) throws StarIODeviceSettingException;
    
  • Parameter

    Name

    Contents

    Type

    setting

    Network Setting Information

    StarNetworkSetting

  • Return value

    None

  • Exception

    Contents

    Type

    When port open fails
    When an incorrect portName is passed
    when a communication failure occurs

    StarIODeviceSettingException

  • Examples

    scope.launch {
        try {
            val manager = StarNetworkManager(portNameEditText.text.toString(), baseContext)
    
            val setting = StarNetworkSetting()
    
            //Example) When setting to SteadyLanSetting to "Disable"
            setting.steadyLanSetting = SteadyLanSetting.Disable
    
            manager.apply(setting)
    
        } catch (e: StarIODeviceSettingException) {
        }
    }
    

    Refer to StarIODeviceSettingSDK.