Open mehtahardikr opened 5 months ago
@mehtahardikr I understand that you're looking for a callback mechanism to automatically reconnect or monitor the printer when it's powered back on after being turned off.
At the moment, our library does not support a callback feature for detecting the printer's power state changes (off to on transitions). Therefore, we recommend implementing a solution on your application's side where you would explicitly attempt to reopen the connection with the printer once you detect it's back online. This could involve periodically checking the printer's availability on the network and attempting a reconnection once it's found to be accessible again.
We take your feedback seriously and will continue to explore the possibility of adding such a specification in future updates.
@Tatsuki-Yamamoto2731 : Thanks for the reply. Can you help us little for the same like as we have already printer in monitor mode like its already open and now turn off the power and turn back on. now in this case how we can identify that wether its online or not ? as we have instance of active printer is with us and thats monitoring the printer as well. can you suggest for the same. its really help us to get most of it.
Example steps.
Can you please guide in this case that how we can again start monitor printer with same instance and continue print documentt as the last commad is that to print the document.
Here your help needed so, can you please guide for the same. Thanks
@mehtahardikr If the printer is turned off while monitoring, onCommunicationError will be caused. After that, you have to redo from openAsync() in order to monitor the status or send printing data. What you want to do may be realized by the following steps:
Could you please try these steps?
@Tatsuki-Yamamoto2731 : Thank you for the reply.
onCommunicationError
is called on printerDelegate
or when we called openSync()
?
as it should be on printerDelegate so can understand that there is something wrong with monitor printer no ?
@mehtahardikr onCommunicationError will be called on printerDelegate. (For your reference, if openAsync() is executed when the printer is turned off, it will cause StarIO10NotFoundException.)
Do you mean that when you turn off the printer during monitoring, onCommunicationError is not called on printerDelegate? If so, the way to monitor the printer may have something wrong. Could you please let us know your situation?
Yes, when we turn off the printer during monitoring, onCommunicationError is not called on printerDelegate?
Here one thing noticed.
Find the printer
Start monitor the printer
Print doc for print data
Switch off the printer
its goes to onCommunicationError method of printer delegate
And another thing also noticed.
Find the printer
Start monitor the printer
Switch off the printer
its not going to onCommunicationError method of printer delegate ( here it has to go here so can acknowledge that there is commnucation error and app will write logic to reconnect and start monitoring.
@mehtahardikr You found that onCommunicationError is called after printing, but onCommunicationError is not called without printing, is it correct? Then, I tried with our sample code, but I couldn't recreate your problem. In other words, in our sample code, onCommunicationError is called on printerDelegate without printing. Therefore, I want you to try our sample code.
@Tatsuki-Yamamoto2731 have you tried with MCprint 3 printer and using LAN Connection mode ?
@mehtahardikr Yes, I tried it with mC-Print3 via LAN.
@Tatsuki-Yamamoto2731 : Tried by directly remove power cable from socket for printer ( switch off ) it did not fire up onCommunicationError event. You only checked by pressing power button on printer ?
@mehtahardikr I initially turned off the printer by pressing the power button, but I additionally checked by removing the power cable from the printer to turn it off as you indicated. However, the results were the same, the onCommunicationError occurred even when the power cable was removed from the printer.
Did you try with our sample code?
yeah got it. getting callback now thanks. @Tatsuki-Yamamoto2731
Can you please update on specific callback that you are foing to implement for new version of this sdk?
https://github.com/star-micronics/StarXpand-SDK-Android/issues/22#issuecomment-2065652708
until can check with that work around onCommunicationError from which start trying to connect printer again.
@mehtahardikr I understand that you are now able to receive onCommunicationError.
Can you please update on specific callback that you are foing to implement for new version of this SDK?
We received your feedback and we will consider adding the function in the future.
Description
We have printer mC-Print3 connected through LAN. We want to reconnect printer or monitor printer when power turn back on. Case is simple
When its trun back on from off state we are not able to make it monitor again
Your device where the bug occurs
Your printer
Can we have any callback for the same ?