SerialPortUtil | Android串口通信工具

 by   tyhjh Java Version: Current License: No License

kandi X-RAY | SerialPortUtil Summary

kandi X-RAY | SerialPortUtil Summary

SerialPortUtil is a Java library. SerialPortUtil has no bugs, it has no vulnerabilities, it has build file available and it has low support. You can download it from GitHub.


            kandi-support Support

              SerialPortUtil has a low active ecosystem.
              It has 29 star(s) with 3 fork(s). There are 1 watchers for this library.
              It had no major release in the last 6 months.
              There are 3 open issues and 0 have been closed. On average issues are closed in 221 days. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of SerialPortUtil is current.

            kandi-Quality Quality

              SerialPortUtil has 0 bugs and 0 code smells.

            kandi-Security Security

              SerialPortUtil has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              SerialPortUtil code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              SerialPortUtil does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              SerialPortUtil releases are not available. You will need to build from source code and install.
              Build file is available. You can build the component from source.
              Installation instructions are not available. Examples and code snippets are available.
              SerialPortUtil saves you 258 person hours of effort in developing the same functionality from scratch.
              It has 627 lines of code, 30 functions and 19 files.
              It has medium code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed SerialPortUtil and discovered the below as its top functions. This is intended to give you an instant insight into SerialPortUtil implemented functionality, and help decide if they suit your requirements.
            • Initializes the tv_hello
            • Sets the device path
            • Returns output stream
            • Gets an InputStream for this object
            • Send an error message
            • Set whether to output to output
            • Send data to the serial port
            • Sets the time out in milliseconds
            • Sets the Baudrate for the serial port
            • Creates the SerialPortService
            • Reads all available drivers from the terminal
            • Get the names of all the devices in the system
            • Convert a byte array to a hex string
            • Get the names of all devices
            • Closes the serial port
            • Close the port
            • Main entry point
            • Converts a hex string to a byte array
            • Converts an array of strings to a hex string
            Get all kandi verified functions for this library.

            SerialPortUtil Key Features

            No Key Features are available at this moment for SerialPortUtil.

            SerialPortUtil Examples and Code Snippets

            No Code Snippets are available at this moment for SerialPortUtil.

            Community Discussions

            Trending Discussions on SerialPortUtil


            Android Library thread safe
            Asked 2019-Feb-21 at 14:56

            I've a small android library which handles a serial port, it has basic functionality like open, read, write and close.

            I have made an applications that uses this library to write on the serial port and read the responses, within this application there is a thread that periodically opens the serial port asks for the status get the response and close the serial port.

            I want to protect the serial communication in a way that if the main thread opens the communication the secondary thread that only checks the status can not open it and wait for the main thread to finish.



            Answered 2019-Feb-21 at 14:56

            How can I tell the checker thread that the communication is already opened and make him wait until the main thread finish.

            I don't fully understand your code but the critical thing with threads and locking is to make sure that all threads are calling code that is synchronized on the same object instance.

            If I synchronize an object, there still is a window when the object is not synchronized.

            Not if you use the same instance of the object. Making each of the public methods in SerialChannel synchronized will make sure that only 1 thread can be using the object at once.

            I suspect that your real problem is not about protecting the SerialChannel object but more about race-conditions between the threads. They need to make multiple calls to the methods and they can block each other or interleave in an improper manner.

            You can get around this with a couple of changes. You can make the send(...) and receive(...) methods auto-opening. Threads would just call send() or receive() which in turn would internally call open() if the fileInputStream or fileOutputStream was null. The thread would be inside of a synchronized so this would not be interrupted by another thread.

            Another completely different model to consider would be to have one thread reading from the serial port and another writing to it that are dedicated to that task -- they would be built into the SerialChannel object. They would share data with the external threads using a read BlockingQueue and a write BlockingQueue. Then the serial port is opened early in your application which starts the IO threads and the external threads never worry about the IO. They just put() and take() from the queues. I typically do this (for example) when reading and writing to the console.

            Hope something here helps.


            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install SerialPortUtil

            You can download it from GitHub.
            You can use SerialPortUtil like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the SerialPortUtil component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer For Gradle installation, please refer .


            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
          • HTTPS


          • CLI

            gh repo clone tyhjh/SerialPortUtil

          • sshUrl


          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Consider Popular Java Libraries


            by CyC2018


            by Snailclimb


            by MisterBooo


            by spring-projects

            Try Top Libraries by tyhjh


            by tyhjhJava


            by tyhjhJava


            by tyhjhJava


            by tyhjhJava


            by tyhjhJava