Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/slowtec/tokio-modbus
A tokio-based modbus library
https://github.com/slowtec/tokio-modbus
ascii async automation client fieldbus library modbus non-blocking rtu rust server support tcp tokio
Last synced: about 2 months ago
JSON representation
A tokio-based modbus library
- Host: GitHub
- URL: https://github.com/slowtec/tokio-modbus
- Owner: slowtec
- License: apache-2.0
- Created: 2017-10-21T19:51:54.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2024-10-17T21:20:10.000Z (about 2 months ago)
- Last Synced: 2024-10-20T16:44:12.444Z (about 2 months ago)
- Topics: ascii, async, automation, client, fieldbus, library, modbus, non-blocking, rtu, rust, server, support, tcp, tokio
- Language: Rust
- Size: 534 KB
- Stars: 408
- Watchers: 14
- Forks: 121
- Open Issues: 32
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSES/Apache-2.0.txt
Awesome Lists containing this project
- awesome-rust - slowtec/tokio-modbus - based [modbus](http://modbus.org) library. [![Build Status](https://api.travis-ci.org/slowtec/tokio-modbus.svg?branch=master)](https://travis-ci.org/slowtec/tokio-modbus) (Applications / Industrial automation)
- awesome-rust - slowtec/tokio-modbus - based [modbus](https://modbus.org) library. (Applications / Industrial automation)
- awesome-rust-cn - slowtec/tokio-modbus
- awesome-rust-zh - slowtec/tokio-modbus - 一个基于[tokio](https://tokio.rs)的[modbus](http://modbus.org) 库。[![Build Status](https://api.travis-ci.org/slowtec/tokio-modbus.svg?branch=master)](https://travis-ci.org/slowtec/tokio-modbus) (应用 / 工业自动化)
- awesome-rust - slowtec/tokio-modbus - A [tokio](https://tokio.rs)-based [modbus](https://modbus.org) library. (Applications / Industrial automation)
- awesome-rust - slowtec/tokio-modbus - based [modbus](http://modbus.org) library. [![Build Status](https://api.travis-ci.org/slowtec/tokio-modbus.svg?branch=master)](https://travis-ci.org/slowtec/tokio-modbus) (应用 Applications / 工业自动化 Industrial automation)
- awesome-rust-cn - slowtec/tokio-modbus - based [modbus](http://modbus.org) library. [![Build Status](https://api.travis-ci.org/slowtec/tokio-modbus.svg?branch=master)](https://travis-ci.org/slowtec/tokio-modbus) (应用 / Industrial automation)
- fucking-awesome-rust - slowtec/tokio-modbus - A 🌎 [tokio](tokio.rs)-based 🌎 [modbus](modbus.org) library. (Applications / Industrial automation)
- fucking-awesome-rust - slowtec/tokio-modbus - A 🌎 [tokio](tokio.rs)-based 🌎 [modbus](modbus.org) library. (Applications / Industrial automation)
README
# tokio-modbus
A pure [Rust](https://www.rust-lang.org)
[Modbus](https://en.wikipedia.org/wiki/Modbus) library based on
[tokio](https://tokio.rs).[![Crates.io](https://img.shields.io/crates/v/tokio-modbus.svg)](https://crates.io/crates/tokio-modbus)
[![Docs.rs](https://docs.rs/tokio-modbus/badge.svg)](https://docs.rs/tokio-modbus/)
[![Security audit](https://github.com/slowtec/tokio-modbus/actions/workflows/security-audit.yaml/badge.svg)](https://github.com/slowtec/tokio-modbus/actions/workflows/security-audit.yaml)
[![Continuous integration](https://github.com/slowtec/tokio-modbus/actions/workflows/build-and-test.yaml/badge.svg)](https://github.com/slowtec/tokio-modbus/actions/workflows/build-and-test.yaml)
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE-MIT)
[![Apache 2.0 licensed](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](./LICENSE-APACHE)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`:
```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
- `"rtu-over-tcp-server"`: (Asynchronous) RTU over TCP server#### Examples
If you only need an asynchronous TCP client add the following line to your
Cargo.toml file:```toml
[dependencies]
tokio-modbus = { version = "*", default-features = false, features = ["tcp"] }
```For an asynchronous RTU client:
```toml
[dependencies]
tokio-modbus = { version = "*", default-features = false, features = ["rtu"] }
```For an RTU server:
```toml
[dependencies]
tokio-modbus = { version = "*", default-features = false, features = ["rtu-server"] }
```For a TCP server:
```toml
[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](https://github.com/slowtec/tokio-modbus/tree/main/examples) folder.## Testing
The workspace contains documentation, tests, and examples for all available
features.```sh
cargo test --workspace
cargo test --workspace --all-features
```## Protocol-Specification
- [Modbus Application Protocol Specification v1.1b3 (PDF)](http://modbus.org/docs/Modbus_Application_Protocol_V1_1b3.pdf)
- [Modbus over serial line specification and implementation guide v1.02 (PDF)](http://modbus.org/docs/Modbus_over_serial_line_V1_02.pdf)
- [Modbus Messaging on TCP/IP Implementation Guide v1.0b (PDF)](http://modbus.org/docs/Modbus_Messaging_Implementation_Guide_V1_0b.pdf)## License
Copyright (c) 2017-2024 [slowtec GmbH](https://www.slowtec.de)
[MIT](LICENSES/MIT.txt)/[Apache-2.0](LICENSES/Apache-2.0.txt)