5.1. SMNetworkManager
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. init
Creates the instance.
5.1.2. load
Gets the value specified from the printer.
Declaration
func load() throws -> SMNetworkSetting
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
guard let portName = self.portNameTextField.text else { return } DispatchQueue.global().async { guard let starNetworkManager = SMNetworkManager(portName:portName) else { return } let starNetworkSetting : SMNetworkSetting do { starNetworkSetting = try starNetworkManager.load() } catch { } }
Refer to StarIODeviceSettingSDK.
5.1.3. apply
Set the specified value to the printer.
Important
The printer is reset after this method was executed.
Declaration
func apply(SMNetworkSetting) throws
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
guard let portName = self.portNameTextField.text else { return } DispatchQueue.global().async { guard let starNetworkManager = SMNetworkManager(portName: portName) else { return } let starNetworkSetting = SMNetworkSetting() //Example) When setting to SteadyLanSetting to "Disable" starNetworkSetting.steadyLAN = .disable do { try starNetworkManager.apply(starNetworkSetting) } catch { } }
Refer to StarIODeviceSettingSDK.