Git Product home page Git Product logo

tokio-modbus's Introduction

tokio-modbus

A pure Rust Modbus library based on tokio.

Crates.io Docs.rs Security audit Continuous integration MIT licensed Apache 2.0 licensed

Modbus is based on a master/slave communication pattern. To avoid confusion with the Tokio terminology the master is called client and the slave is called server in this library.

Features

  • Pure Rust library
  • Modbus TCP or RTU at your choice
  • Both async (non-blocking, default) and sync (blocking, optional)
  • Client API
  • Server implementations
    • for out-of-the-box usage or
    • as a starting point for a customized implementation
  • Open source (MIT/Apache-2.0)

Installation

Add this to your Cargo.toml:

[dependencies]
tokio-modbus = "*"

Cargo Features

  • "rtu": Asynchronous RTU client (default)
  • "tcp": Asynchronous TCP client (default)
  • "rtu-sync: Synchronous RTU client
  • "tcp-sync": Synchronous TCP client
  • "rtu-server": (Asynchronous) RTU server
  • "tcp-server": (Asynchronous) TCP server

Examples

If you only need an asynchronous TCP client add the following line to your Cargo.toml file:

[dependencies]
tokio-modbus = { version = "*", default-features = false, features = ["tcp"] }

For an asynchronous RTU client:

[dependencies]
tokio-modbus = { version = "*", default-features = false, features = ["rtu"] }

For an RTU server:

[dependencies]
tokio-modbus = { version = "*", default-features = false, features = ["rtu-server"] }

For a TCP server:

[dependencies]
tokio-modbus = { version = "*", default-features = false, features = ["tcp-server"] }

Examples

Various examples for Modbus RTU and TCP using either the asynchronous or synchronous API can be found in the examples folder.

Testing

The workspace contains documentation, tests, and examples for all available features.

cargo test --workspace
cargo test --workspace --all-features

Protocol-Specification

License

Copyright (c) 2017-2023 slowtec GmbH

MIT/Apache-2.0

tokio-modbus's People

Contributors

bootrecords avatar cdbennett avatar colinfinck avatar flosse avatar gustavowd avatar josugz avatar justinyhuang avatar lancechentw avatar laumann avatar louisdispa avatar lovasoa avatar mdonoughe avatar mosolovsa avatar not-fl3 avatar obayemi avatar rspendl avatar sirhcel avatar ssnover avatar tarnadas avatar uklotzde avatar zzeroo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.