5.1. StarNetworkManager
Class to set printer’s network settings.
Constructor
Name
Contents
Creates the instance.
Method
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
Exception
Contents
Type
When a null to portName is passed
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
Exception
Contents
Type
When port open failsWhen an incorrect portName is passedwhen a communication failure occurs
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
Return value
None
Exception
Contents
Type
When port open failsWhen an incorrect portName is passedwhen a communication failure occurs
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.