This repository is deprecated; please follow the main search page or use the ‘Related code repos’ widget on the right side of the current page.

dslink-java-serial

A slightly modified version of the original generic DSLink for serial communication.
This version will read the serial port buffer until either the end code is found or the end of the buffer is reached. This is useful for serial devices that do not have a specific end code, but simply respond with a string of data (like UPS devices that have simple little minds). It is also useful for devices that have changing responses and therefore do not have a specific end code.

Usage

  • Install the dslink as usual on the EFM instance that will be connecting to the serial device.

  • Add a connection by specifying a serial port, baud rate, etc. Available serial ports are listed in the dropdown in the "add connection" action. You can rescan the system for available ports using the "scan for serial ports" action.

  • The "Start Code" and "End Code" parameters specify how the connection will identify the beginning and end of a message. In this implementation, the end code is optional. Each should be a single byte in hexadecimal or decimal notation (e.g. '0xE7' or '231').

  • The "Charset" specifies how the connection will parse incoming messages and encode outgoing messages. Setting the charset to 'None' will cause the connection to interpret messages as raw byte data in hex notation, with spaces between bytes (e.g. 48 65 6c 6c 6f 2c 20 57 6f 72 6c 64 21).

The connection listens on its serial port as long as its node is subscribed to, and the node's value is always set to the last message recieved. Messages can be sent to the serial port using the "send message" action, which allows you to choose start and end codes different from those used for incoming messages.

Credits and references

  1. This dslink is based entirely on the original dslink-java-serial (https://developer.cisco.com/codeexchange/github/repo/IOT-DSA/dslink-java-serial) so all credit to the authors there.

published

View code on GitHub
  • Owner

  • Contributors

    +4Github contributors
  • Categories

  • Programming Languages

    Java
  • License

    GNU General Public License v3.0

Code Exchange Community

Get help, share code, and collaborate with other developers in the Code Exchange community.View Community
Disclaimer:
Cisco provides Code Exchange for convenience and informational purposes only, with no support of any kind. This page contains information and links from third-party websites that are governed by their own separate terms. Reference to a project or contributor on this page does not imply any affiliation with or endorsement by Cisco.