File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
java/org/kabiri/android/usbterminal/arduino Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -62,7 +62,17 @@ class ArduinoHelper(private val context: Context,
6262 _liveInfoOutput .postValue(context.getString(R .string.helper_info_usb_permission_requested))
6363 } else {
6464 _liveErrorOutput .postValue(context.getString(R .string.helper_error_device_not_found))
65- connection.close()
65+ try {
66+ connection.close()
67+ } catch (e: UninitializedPropertyAccessException ) {
68+ _liveErrorOutput .postValue(context.getString(
69+ R .string.helper_error_connection_not_ready_to_close))
70+ _liveErrorOutput .postValue(e.message)
71+ } catch (e: Exception ) {
72+ _liveErrorOutput .postValue(context.getString(
73+ R .string.helper_error_connection_failed_to_close))
74+ _liveErrorOutput .postValue(e.message)
75+ }
6676 }
6777 }
6878 } else {
Original file line number Diff line number Diff line change 1818 <string name =" helper_error_serial_connection_not_opened" >\nPort not opened - There might be a problem with the serial connection to Arduino</string >
1919 <string name =" helper_error_write_problem" >Serial Write encountered an error:</string >
2020 <string name =" helper_error_connection_closed_unexpectedly" >Device connection was closed unexpectedly</string >
21+ <string name =" helper_error_connection_not_ready_to_close" >No device connection to close</string >
22+ <string name =" helper_error_connection_failed_to_close" >Device connection failed to close</string >
2123 <string name =" helper_info_serial_connection_opened" >\nSerial Connection Opened</string >
2224 <string name =" helper_info_usb_permission_requested" >Requested permission to access the USB device…</string >
2325 <string name =" helper_info_checking_attached_usb_devices" >\nChecking attached USB devices…</string >
You can’t perform that action at this time.
0 commit comments