Open alsedi opened 1 year ago
@alsedi Apologies for the delayed response to this issue.
I understood the problem you've encountered, and regret to inform you that our current library indeed behaves as you have described. We appreciate your request and acknowledge the issue you've raised. We will take your feedback into consideration for potential improvements in our library.
As a temporary workaround, I suggest attempting a re-discovery excluding the interface that triggered the errorCode: BluetoothUnavailable or errorCode: NetworkUnavailable. This might serve as a viable method to continue discovery on available connection types.
Please consider trying this approach and let us know if it helps with your situation.
Description
Printers discovery stops with the exception when
Bluetooth
orLAN
interface types are used for discovery but not available on the phone. For example, Bluetooth is turned off (forInterfaceType.Bluetooth
), or WIFI and 3G are turned off (forInterfaceType.LAN
).Your device where the bug occurs
Your printer
Your development environment
The result of executing the command
ver
on Windows,sw_vers
on macOS,uname –a
on Linux, or these equivalent commands.To Reproduce
Steps to reproduce the behavior:
try { discoveryManager = StarDeviceDiscoveryManagerFactory.create(interfaceType, context)
} catch (error: Exception) { AppLog.d("App -> Star Printers discovery process failed $error") }
2023-06-20 14:25:47.998 App -> Star Printers discovery is starting 2023-06-20 14:25:47.998 App -> Star Printers discovery started 2023-06-20 14:25:48.122 BT Manager -> Paired Bluetooth devices: [:56:CB, :8E:74, :69:76, :84:CB] 2023-06-20 14:57:05.447 StarSDK -> StarPrinter.toString(): openTimeout : 10000, getStatusTimeout : 5000, printTimeout : 30000, connectionSettings : {interfaceType : Bluetooth, identifier : 56CB, autoSwitchInterface : false}, information : {model : mC_Print3, emulation : StarPRNT, reserved : {bluetoothAddress=56CB, macAddress=null, specifiedIdentifier=null, usbSerialNumber=null, device=:56:CB}} 2023-06-20 14:57:05.450 StarSDK -> StarPrinter.toString(): openTimeout : 10000, getStatusTimeout : 5000, printTimeout : 30000, connectionSettings : {interfaceType : Bluetooth, identifier : 8E74, autoSwitchInterface : false}, information : {model : Unknown, emulation : Unknown, reserved : {bluetoothAddress=8E74, macAddress=null, specifiedIdentifier=null, usbSerialNumber=null, device=:8E:74}} 2023-06-20 14:57:05.453 StarSDK -> StarPrinter.toString(): openTimeout : 10000, getStatusTimeout : 5000, printTimeout : 30000, connectionSettings : {interfaceType : Bluetooth, identifier : 6976, autoSwitchInterface : false}, information : {model : Unknown, emulation : Unknown, reserved : {bluetoothAddress=6976, macAddress=null, specifiedIdentifier=null, usbSerialNumber=null, device=:69:76}} 2023-06-20 14:57:05.457 StarSDK -> StarPrinter.toString(): openTimeout : 10000, getStatusTimeout : 5000, printTimeout : 30000, connectionSettings : {interfaceType : Bluetooth, identifier : 84CB, autoSwitchInterface : false}, information : {model : SM_L200, emulation : StarPRNT, reserved : {bluetoothAddress=84CB, macAddress=null, specifiedIdentifier=null, usbSerialNumber=null, device=:84:CB}} 2023-06-20 14:57:05.739 StarSDK -> StarPrinter.toString(): openTimeout : 10000, getStatusTimeout : 5000, printTimeout : 30000, connectionSettings : {interfaceType : Lan, identifier : E874, autoSwitchInterface : false}, information : {model : mC_Print3, emulation : StarPRNT, reserved : {bluetoothAddress=null, macAddress=E874, specifiedIdentifier=null, usbSerialNumber=null, configGateway=0.0.0.0, configIPAddress=0.0.0.0, configPrint=false, configSubnetMask=0.0.0.0, deviceClass=PRINTER, deviceCommandSet=STAR, deviceManufacture=Star, deviceModel=MCP31 (STR-001), deviceStatus=[41, -118, 2, 0, 0, 0, 0, 2, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], dhcp=true, firmwareVersionBoot=3.6, firmwareVersionMain=3.6, gateway=.1, hostName=, ipAddress=.2, ipAddressProtocol=DHCP, ipVersion=1, multiSession=false, name=mC-Print3, nameDetail=MCP31L, pldRevision= , productSerialNumber=49, rarp=false, responseVersion=4.0.0, subnetMask=.0, usedIPAddress=.255, usedPort=0}} 2023-06-20 14:57:05.788 StarSDK -> StarPrinter.toString(): openTimeout : 10000, getStatusTimeout : 5000, printTimeout : 30000, connectionSettings : {interfaceType : Lan, identifier : CD57, autoSwitchInterface : false}, information : {model : mC_Print3, emulation : StarPRNT, reserved : {bluetoothAddress=null, macAddress=CD57, specifiedIdentifier=null, usbSerialNumber=null, configGateway=0.0.0.0, configIPAddress=0.0.0.0, configPrint=false, configSubnetMask=0.0.0.0, deviceClass=PRINTER, deviceCommandSet=STAR, deviceManufacture=Star, deviceModel=MCP31 (STR-001), deviceStatus=[41, -118, 2, 0, 0, 0, 0, 2, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], dhcp=true, firmwareVersionBoot=3.6, firmwareVersionMain=3.6, gateway=.1, hostName=, ipAddress=.3, ipAddressProtocol=DHCP, ipVersion=1, multiSession=false, name=mC-Print3, nameDetail=MCP31L, pldRevision= , productSerialNumber=91, rarp=false, responseVersion=4.0.0, subnetMask=.0, usedIPAddress=.255, usedPort=0}} 2023-06-20 14:57:05.789 StarSDK -> StarPrinter.toString(): openTimeout : 10000, getStatusTimeout : 5000, printTimeout : 30000, connectionSettings : {interfaceType : Lan, identifier : 7A42, autoSwitchInterface : false}, information : {model : mC_Print3, emulation : StarPRNT, reserved : {bluetoothAddress=null, macAddress=7A42, specifiedIdentifier=null, usbSerialNumber=null, configGateway=0.0.0.0, configIPAddress=0.0.0.0, configPrint=false, configSubnetMask=0.0.0.0, deviceClass=PRINTER, deviceCommandSet=STAR, deviceManufacture=Star, deviceModel=MCP31 (STR-001), deviceStatus=[41, -118, 2, 0, 0, 4, 0, 2, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], dhcp=true, firmwareVersionBoot=3.6, firmwareVersionMain=3.6, gateway=.1, hostName=, ipAddress=.4, ipAddressProtocol=DHCP, ipVersion=1, multiSession=false, name=mC-Print3, nameDetail=MCP31LB, pldRevision= , productSerialNumber=53, rarp=false, responseVersion=4.0.0, subnetMask=.0, usedIPAddress=.255, usedPort=0}} 2023-06-20 14:57:05.790 StarSDK -> StarPrinter.toString(): openTimeout : 10000, getStatusTimeout : 5000, printTimeout : 30000, connectionSettings : {interfaceType : Lan, identifier : 7A20, autoSwitchInterface : false}, information : {model : mC_Print3, emulation : StarPRNT, reserved : {bluetoothAddress=null, macAddress=7A20, specifiedIdentifier=null, usbSerialNumber=null, configGateway=0.0.0.0, configIPAddress=0.0.0.0, configPrint=false, configSubnetMask=0.0.0.0, deviceClass=PRINTER, deviceCommandSet=STAR, deviceManufacture=Star, deviceModel=MCP31 (STR-001), deviceStatus=[41, -118, 2, 0, 0, 0, 0, 2, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], dhcp=true, firmwareVersionBoot=3.7, firmwareVersionMain=3.7, gateway=.1, hostName=, ipAddress=.5, ipAddressProtocol=DHCP, ipVersion=1, multiSession=false, name=mC-Print3, nameDetail=MCP31LB, pldRevision= , productSerialNumber=79, rarp=false, responseVersion=4.0.0, subnetMask=.0, usedIPAddress=.255, usedPort=0}} 2023-06-20 14:57:05.790 StarSDK -> StarPrinter.toString(): openTimeout : 10000, getStatusTimeout : 5000, printTimeout : 30000, connectionSettings : {interfaceType : Lan, identifier : F7D0, autoSwitchInterface : false}, information : {model : mC_Print3, emulation : StarPRNT, reserved : {bluetoothAddress=null, macAddress=F7D0, specifiedIdentifier=null, usbSerialNumber=null, configGateway=0.0.0.0, configIPAddress=0.0.0.0, configPrint=false, configSubnetMask=0.0.0.0, deviceClass=PRINTER, deviceCommandSet=STAR, deviceManufacture=Star, deviceModel=MCP31 (STR-001), deviceStatus=[41, -118, 2, 0, 0, 0, 0, 2, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], dhcp=true, firmwareVersionBoot=3.6, firmwareVersionMain=3.6, gateway=.1, hostName=, ipAddress=.6, ipAddressProtocol=DHCP, ipVersion=1, multiSession=false, name=mC-Print3, nameDetail=MCP31L, pldRevision= , productSerialNumber=28, rarp=false, responseVersion=4.0.0, subnetMask=.0, usedIPAddress=.255, usedPort=0}} 2023-06-20 14:57:05.791 StarSDK -> StarPrinter.toString(): openTimeout : 10000, getStatusTimeout : 5000, printTimeout : 30000, connectionSettings : {interfaceType : Lan, identifier : E4C0, autoSwitchInterface : false}, information : {model : mC_Print3, emulation : StarPRNT, reserved : {bluetoothAddress=null, macAddress=E4C0, specifiedIdentifier=null, usbSerialNumber=null, configGateway=0.0.0.0, configIPAddress=0.0.0.0, configPrint=false, configSubnetMask=0.0.0.0, deviceClass=PRINTER, deviceCommandSet=STAR, deviceManufacture=Star, deviceModel=MCP31 (STR-001), deviceStatus=[41, -118, 2, 0, 0, 0, 0, 2, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], dhcp=true, firmwareVersionBoot=3.7, firmwareVersionMain=3.7, gateway=.1, hostName=, ipAddress=.7, ipAddressProtocol=DHCP, ipVersion=1, multiSession=false, name=mC-Print3, nameDetail=MCP31L, pldRevision= , productSerialNumber=35, rarp=false, responseVersion=4.0.0, subnetMask=.0, usedIPAddress=.255, usedPort=0}} 2023-06-20 14:25:47.998 App -> Star Printers discovery finished
2023-06-20 15:12:50.127 D Star Printers discovery is starting 2023-06-20 15:12:50.129 D Star Printers discovery process failed: com.starmicronics.stario10.StarIO10IllegalHostDeviceStateException: Bluetooth unavailable. errorCode: BluetoothUnavailable
2023-06-20 15:19:22.620 D Star Printers discovery process failed: com.starmicronics.stario10.StarIO10IllegalHostDeviceStateException: Network unavailable. errorCode: NetworkUnavailable