Adds the ability to reproduce the issue where retrieving network printer statuses fails after multiple attempts. Getting a printer status works correctly the first time, but fails the second time with the following error:
Failed to getPort. Printer is in use.
During development it was discovered that calling SMPort.releasePort(port)
twice will successfully release the port and the status can be retrieved, whereas calling it only once will not.
STR:
- Turn on a Wi-Fi printer.
- Launch the app and press
Scan Network
for the app to discover the Wi-Fi printer. Select the printer from the list.
- On the printer details page, press
Get status, release port TWICE
. Verify the printer status changes to Online
.
- Press
Get status, release port TWICE
a few more times, verifying the status is always Online
.
- Press
Get status, release port ONCE
, verify the status is Online
.
- Press
Get status, release port ONCE
again, and verify the status changes to Offline
after a few seconds, with the following error message logged. Any subsequent attempt to get the printer status will result in this failure.
StarSampleApp[509:56850] Failed to open printer port, with an error of: Error Domain=jp.star-m.stario Code=-100 "Failed to getPort. Printer is in use." UserInfo={NSLocalizedDescription=Failed to getPort. Printer is in use.}