How to Manage Serial Port Disconnections in Application Development: Difference between revisions

From wizarPOS
(Created page with " When app read from serial port, if occurs the error message: "Level 3 halted" in the log, that means the serial port cable is disconnected, then close the serial port in...")
 
(Replaced content with "{{Migrating|https://smartpossdk.gitbook.io/cloudpossdk/faq/usb-serial-port/close-serial-after-disconnect}}")
Tag: Replaced
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{Migrating|https://smartpossdk.gitbook.io/cloudpossdk/faq/usb-serial-port/close-serial-after-disconnect}}
  When app read from serial port, if occurs the error message: "Level 3 halted" in the log, that means the serial port cable is disconnected, then close the serial port in the app, then try to open it again. If app can not open serial port, please try to connect the serial port cable again.
  In Java SDK, you can catch the DeviceException when do serail port read, snippet code:
<syntaxhighlight lang="java">
try{
  ....
  serialportDevice.read(...);
  ....
}catch(DeviceException e){
  If (e.getMessage.contains("Level 3 halted")){
    serialportDevice.close();
    // then open serial port in somewhere, depends on your app logic.
  }
}
</syntaxhighlight >

Latest revision as of 08:26, 7 April 2024

Please visit new link of same subject:

https://smartpossdk.gitbook.io/cloudpossdk/faq/usb-serial-port/close-serial-after-disconnect

We're making a move! Our site's content is migrating to a new URL, to provide you with an enhanced browsing experience. Please update your bookmarks accordingly. Thank you for your continuous support!