Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StarIO10InUseException when printer restarted or internet fluctuates #28

Open
zaibniazinnowi opened this issue Aug 19, 2024 · 12 comments
Open

Comments

@zaibniazinnowi
Copy link

Description

The printer throws a StarIO10UnprintableException when it loses its internet connection during printing, and after retrying, the exception changes to StarIO10InUseException. The printer will not resume printing until it is restarted. The connection loss could be due to internet fluctuations, or the printer being unplugged.

When printer throws StarIO10UnprintableException or StarIO10InUseException. we always disconnect to make printer available for next iteration but failed.

Your device where the bug occurs

  • Device:
    POS(ELO), Samsung
  • OS:
    • Android *
  • Version
    Version 14 and 9

Your printer

  • Model Names:
    SP742 (STR-001)
  • Firmware Version:
    (com.starmicronics:stario10:1.6.0)
  • Interface:
    Ethernet/LAN

Is it possible to expose method to release or reset printer instance from SDK so that we do not need to restart printer every time?

@zaibniazinnowi zaibniazinnowi changed the title StarIO10InUseException when printer restarted or on internet fluctuation StarIO10InUseException when printer restarted or internet fluctuates Aug 19, 2024
@Tatsuki-Yamamoto2731 Tatsuki-Yamamoto2731 self-assigned this Aug 20, 2024
@Tatsuki-Yamamoto2731 Tatsuki-Yamamoto2731 added the Status: triage Start out by looking at issues label Aug 20, 2024
@Tatsuki-Yamamoto2731
Copy link

@zaibniazinnowi StarIO10InUseException occurs when the printer has already connected a device. Please check if there is another device that connects to the printer on the network.
If there are no other devices, perhaps the previous connection was left open because of some reason. In that case, executing closeAsync() might recover from the error.

@Tatsuki-Yamamoto2731 Tatsuki-Yamamoto2731 added Status: question Further information is requested and removed Status: triage Start out by looking at issues labels Aug 20, 2024
@zaibniazinnowi
Copy link
Author

zaibniazinnowi commented Aug 20, 2024

@Tatsuki-Yamamoto2731
I called this method frequently, but it didn’t resolve the issue.

It was a one-on-one communication. The printer can recover if it enters an error state when it's not actively printing. However, if an error occurs during printing, it initially throws a StarIO10UnprintableException, and then gets stuck in a StarIO10InUseException state until the printer is restarted.

@Tatsuki-Yamamoto2731
Copy link

@zaibniazinnowi Does the problem occur with our sample program?
If not, could you provide a simple source code that recreates the problem?

@zaibniazinnowi
Copy link
Author

suspend fun init() {
    logP("IsConnectedToNetwork: ${context._isNetworkAvailable()} SSID: ${context._getSSID()}")
    kotlin.runCatching {
        logP("StarPrintBatchUtil::init()::${appPrinter.name}(${appPrinter.portName}) (${appPrinter.interfaceType})")
        val identifier = appPrinter.portName
        val interfaceType = getInterfaceType(context, appPrinter.interfaceType)
        val settings = StarConnectionSettings(interfaceType, identifier)
        starPrinter = StarPrinter(settings, context)
        starPrinter!!.closeAsync().await()
        starPrinter!!.openAsync().await()

        isPrinterConnected = true
    }.onSuccess {
        logP("StarPrintBatchUtil::init()::${appPrinter.name}(${appPrinter.portName}): Star Printer Initialized Success")
        isPrinterConnected = true
    }.onFailure {
        if (it is StarIO10Exception) {
        
            Firebase.crashlytics.recordException(it)
    
        isPrinterConnected = false
    }
}

@Tatsuki-Yamamoto2731 

@KHosozawa
Copy link

@zaibniazinnowi

Thank you for the information.
We assume that this issue is caused by the printer's inability to detect a physical disconnection of the communication path (Wi-Fi or LAN cable) and the printer maintains the TCP connection even after the disconnection.

The SDK does not provide a means to solve this problem
However, the printer itself has a function called “#9100 Data Timeout” that causes the printer to discard TCP connections that have not been communicated with for a specified period of time.
Enabling this setting may solve this problem.
Can you try this?

Configuration steps.

  1. Open http://(Printer IP Address) in your browser.
  2. Click “Login” on the left side of the screen to log in.
  3. Click “System Configuration” on the left side of the screen.
  4. Change “#9100 Data Timeout (Sec.)” to “30” and click “Submit” button.
  5. Click “Save” on the left side of the screen, then click the “Execute” button.

@zaibniazinnowi
Copy link
Author

@KHosozawa
Thank you for the solution and it works.
Is there any way to modify all printer's timeout that are currently deploy in the field?

@KHosozawa
Copy link

@zaibniazinnowi

Sorry, but there is no way to change the settings of multiple printers at the same time.

@zaibniazinnowi
Copy link
Author

@KHosozawa
while configuring printer using IP address via browser it sometimes keeps on asking for username and password instead of logging in.

@KHosozawa
Copy link

KHosozawa commented Sep 17, 2024

@zaibniazinnowi
The default user name and password are as follows

  • Username: “root”.
  • Password: “public”

If you change the password and forget it, please follow the procedure below to initialize the network settings.

To initialize the configuration information, set the push switches as follows. Press the switch for 1 to 5 seconds during normal operation. The green and red LEDs will flash in a regular pattern. The interface board settings will return to factory defaults. The printer will automatically restart after the interface board has been initialized.

@zaibniazinnowi
Copy link
Author

zaibniazinnowi commented Sep 17, 2024

@KHosozawa
I have 4 four printers and i updated configuration of one printer. When entered username and password for the first time it asked me to update the password and i updated password with "public" again.

Now when I hit the IP address of other printers, and it keeps on asking for username and password as username and password is correct.

@Tatsuki-Yamamoto2731
Copy link

@zaibniazinnowi
I would like to confirm your situation.

My understanding:

  • You have 4 printers and you accessed one of them (PrinterA, IP Address: XXX.XXX.XXX.XXX).
  • Then, you are asked to update your password on PrinterA's web configuration, and you set it to “public” again.
  • After that, you accessed another printer (PrinterB, IP Address: YYY.YYY.YYY.YYY) and it asked you for a user name and password.
  • You have input the user name and password, but you are asked to enter them again and cannot log in to PrinterB's Web Configuration.

If the above situation is true, the user name or password of PrinterB may have been changed.
Could you please try the following operation and then access the web configuration again?

Press the push switch for 1 to 5 seconds during normal operation. The green and red LEDs will flash in a regular pattern.
Then press the push switch again. The interface board settings will return to factory defaults. The printer will automatically restart after the interface board has been initialized.

*push switch: a small button located near the LAN port on the printer.

@zaibniazinnowi
Copy link
Author

zaibniazinnowi commented Oct 12, 2024

@zaibniazinnowi

Thank you for the information. We assume that this issue is caused by the printer's inability to detect a physical disconnection of the communication path (Wi-Fi or LAN cable) and the printer maintains the TCP connection even after the disconnection.

The SDK does not provide a means to solve this problem However, the printer itself has a function called “#9100 Data Timeout” that causes the printer to discard TCP connections that have not been communicated with for a specified period of time. Enabling this setting may solve this problem. Can you try this?

Configuration steps.

  1. Open http://(Printer IP Address) in your browser.
  2. Click “Login” on the left side of the screen to log in.
  3. Click “System Configuration” on the left side of the screen.
  4. Change “#9100 Data Timeout (Sec.)” to “30” and click “Submit” button.
  5. Click “Save” on the left side of the screen, then click the “Execute” button.

@KHosozawa
I am facing issue with MCP31 (STR-001) Non-fatal Exception: com.starmicronics.stario10.StarIO10CommunicationException
Open failed., and it is expected to resolve after updating configuration mention above but no success.

com.starmicronics.stario10.StarPrinter.a (SourceFile:11)
com.starmicronics.stario10.StarPrinter.a (SourceFile:10)
com.starmicronics.stario10.StarPrinter.b (SourceFile:3)
com.starmicronics.stario10.StarPrinter.access$internalOpen
com.starmicronics.stario10.StarPrinter$s.invokeSuspend (Unknown Source:78)
kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)
kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:106)
kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely (CoroutineScheduler.kt:584)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.executeTask (CoroutineScheduler.kt:793)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.runWorker (CoroutineScheduler.kt:697)
kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run (CoroutineScheduler.kt:684)

After restarting printer, it starts connecting and printing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants