Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RTU support #56

Merged
merged 9 commits into from
Jan 20, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### Next ###
* Add RTU support. See [#56](https://github.com/stepfunc/rodbus/pull/56).

### 0.9.1 ###
* Client callbacks are now not blocking.
See [#53](https://github.com/stepfunc/rodbus/pull/53).
Expand Down
21 changes: 19 additions & 2 deletions deps-config.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
{
"ignore": ["rodbus", "tokio-mock"],
"allowed_licenses": ["Apache-2.0 OR MIT", "MIT", "MIT OR Unlicense"],
"crates": {}
"allowed_licenses": ["BSD-2-Clause", "MIT", "MPL-2.0"],
"crates": {
"crc": {
"license_name": "Apache-2.0 OR MIT",
"file_content": "TUlUIExpY2Vuc2UKCkNvcHlyaWdodCAoYykgMjAxNyBjcmMtcnMgRGV2ZWxvcGVycwoKUGVybWlzc2lvbiBpcyBoZXJlYnkgZ3JhbnRlZCwgZnJlZSBvZiBjaGFyZ2UsIHRvIGFueSBwZXJzb24gb2J0YWluaW5nIGEgY29weQpvZiB0aGlzIHNvZnR3YXJlIGFuZCBhc3NvY2lhdGVkIGRvY3VtZW50YXRpb24gZmlsZXMgKHRoZSAiU29mdHdhcmUiKSwgdG8gZGVhbAppbiB0aGUgU29mdHdhcmUgd2l0aG91dCByZXN0cmljdGlvbiwgaW5jbHVkaW5nIHdpdGhvdXQgbGltaXRhdGlvbiB0aGUgcmlnaHRzCnRvIHVzZSwgY29weSwgbW9kaWZ5LCBtZXJnZSwgcHVibGlzaCwgZGlzdHJpYnV0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OIE5PIEVWRU5UIFNIQUxMIFRIRQpBVVRIT1JTIE9SIENPUFlSSUdIVCBIT0xERVJTIEJFIExJQUJMRSBGT1IgQU5ZIENMQUlNLCBEQU1BR0VTIE9SIE9USEVSCkxJQUJJTElUWSwgV0hFVEhFUiBJTiBBTiBBQ1RJT04gT0YgQ09OVFJBQ1QsIFRPUlQgT1IgT1RIRVJXSVNFLCBBUklTSU5HIEZST00sCk9VVCBPRiBPUiBJTiBDT05ORUNUSU9OIFdJVEggVEhFIFNPRlRXQVJFIE9SIFRIRSBVU0UgT1IgT1RIRVIgREVBTElOR1MgSU4gVEhFClNPRlRXQVJFLgo="
},
"serialport": {
"license_name": "MPL-2.0",
"file_content": "VGhpcyBTb3VyY2UgQ29kZSBGb3JtIGlzIHN1YmplY3QgdG8gdGhlIHRlcm1zIG9mIHRoZSBNb3ppbGxhIFB1YmxpYyBMaWNlbnNlLCB2LiAyLjAuIElmIGEgY29weSBvZgp0aGUgTVBMIHdhcyBub3QgZGlzdHJpYnV0ZWQgd2l0aCB0aGlzIGZpbGUsIFlvdSBjYW4gb2J0YWluIG9uZSBhdCBodHRwczovL21vemlsbGEub3JnL01QTC8yLjAvLgo="
},
"void": {
"license_name": "Apache-2.0 OR MIT",
"file_content": "Q29weXJpZ2h0IChjKSAyMDE1IFRoZSBydXN0LXZvaWQgRGV2ZWxvcGVycwoKUGVybWlzc2lvbiBpcyBoZXJlYnkgZ3JhbnRlZCwgZnJlZSBvZiBjaGFyZ2UsIHRvIGFueSBwZXJzb24gb2J0YWluaW5nIGEgY29weQpvZiB0aGlzIHNvZnR3YXJlIGFuZCBhc3NvY2lhdGVkIGRvY3VtZW50YXRpb24gZmlsZXMgKHRoZSAiU29mdHdhcmUiKSwgdG8gZGVhbAppbiB0aGUgU29mdHdhcmUgd2l0aG91dCByZXN0cmljdGlvbiwgaW5jbHVkaW5nIHdpdGhvdXQgbGltaXRhdGlvbiB0aGUgcmlnaHRzCnRvIHVzZSwgY29weSwgbW9kaW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indings/c/client_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void on_write_complete(rodbus_error_info_t result, void *ctx)
}
/// ANCHOR_END: write_callback

int main()
int main(int argc, char* argv[])
{
// ANCHOR: logging_init
// initialize logging with the default configuration
Expand Down Expand Up @@ -101,15 +101,36 @@ int main()
goto cleanup;
}

// initialize a Modbus TCP client channel
// ANCHOR: create_tcp_channel
rodbus_decode_level_t decode_level = rodbus_decode_level_init();
err = rodbus_create_tcp_client(runtime, "127.0.0.1:502", 100, rodbus_retry_strategy_init(), decode_level, &channel);
if (err) {
printf("Unable to initialize channel: %s\n", rodbus_param_error_to_string(err));
goto cleanup;
// initialize a Modbus client channel
if (argc > 1 && strcmp(argv[1], "--serial") == 0)
{
// ANCHOR: create_rtu_channel
rodbus_decode_level_t decode_level = rodbus_decode_level_init();
err = rodbus_create_rtu_client(runtime,
"/dev/ttySIM0", // path
rodbus_serial_port_settings_init(), // serial settings
1, // max queued requests
1000, // retry delay (in ms)
decode_level, // decode level
&channel
);
if (err) {
printf("Unable to initialize channel: %s\n", rodbus_param_error_to_string(err));
goto cleanup;
}
// ANCHOR_END: create_rtu_channel
}
else
{
// ANCHOR: create_tcp_channel
rodbus_decode_level_t decode_level = rodbus_decode_level_init();
err = rodbus_create_tcp_client(runtime, "127.0.0.1:502", 1, rodbus_retry_strategy_init(), decode_level, &channel);
if (err) {
printf("Unable to initialize channel: %s\n", rodbus_param_error_to_string(err));
goto cleanup;
}
// ANCHOR_END: create_tcp_channel
}
// ANCHOR_END: create_tcp_channel

// request param that we will be reusing
// ANCHOR: request_param
Expand Down
36 changes: 26 additions & 10 deletions ffi/bindings/c/server_example.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void update_input_register(rodbus_database_t *db, void *ctx)
}
}

int main()
int main(int argc, char* argv[])
{
// initialize logging with the default configuration
rodbus_logger_t logger = rodbus_logger_init(&on_log_message, NULL, NULL);
Expand Down Expand Up @@ -150,17 +150,33 @@ int main()
);
// ANCHOR_END: device_map_init

// create the TCP server
// ANCHOR: tcp_server_create
rodbus_decode_level_t decode_level = rodbus_decode_level_init();
err = rodbus_create_tcp_server(runtime, "127.0.0.1:502", 100, map, decode_level, &server);
rodbus_device_map_destroy(map);
// create the server
if (argc > 1 && strcmp(argv[1], "--serial") == 0)
{
// ANCHOR: rtu_server_create
rodbus_decode_level_t decode_level = rodbus_decode_level_init();
err = rodbus_create_rtu_server(runtime, "/dev/ttySIM1", rodbus_serial_port_settings_init(), map, decode_level, &server);
rodbus_device_map_destroy(map);

if (err) {
printf("Unable to initialize server: %s\n", rodbus_param_error_to_string(err));
goto cleanup;
if (err) {
printf("Unable to initialize server: %s\n", rodbus_param_error_to_string(err));
goto cleanup;
}
// ANCHOR_END: rtu_server_create
}
else
{
// ANCHOR: tcp_server_create
rodbus_decode_level_t decode_level = rodbus_decode_level_init();
err = rodbus_create_tcp_server(runtime, "127.0.0.1:502", 100, map, decode_level, &server);
rodbus_device_map_destroy(map);

if (err) {
printf("Unable to initialize server: %s\n", rodbus_param_error_to_string(err));
goto cleanup;
}
// ANCHOR_END: tcp_server_create
}
// ANCHOR_END: tcp_server_create

// state passed to the update callbacks
state_t state = {
Expand Down
30 changes: 24 additions & 6 deletions ffi/bindings/dotnet/examples/client/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,29 @@ static void Main(string[] args)
var runtime = new Runtime(new RuntimeConfig { NumCoreThreads = 4 });
// ANCHOR_END: runtime_init

// initialize a Modbus TCP client channel
// ANCHOR: create_tcp_channel
var decodeLevel = new DecodeLevel();
var channel = Channel.CreateTcpClient(runtime, "127.0.0.1:502", 100, new RetryStrategy(), decodeLevel);
// ANCHOR_END: create_tcp_channel
// initialize a Modbus client channel
Channel channel = null;
if (Array.IndexOf(args, "--serial") == -1)
{
// ANCHOR: create_tcp_channel
var decodeLevel = new DecodeLevel();
channel = Channel.CreateTcpClient(runtime, "127.0.0.1:502", 1, new RetryStrategy(), decodeLevel);
// ANCHOR_END: create_tcp_channel
}
else
{
// ANCHOR: create_rtu_channel
var decodeLevel = new DecodeLevel();
channel = Channel.CreateRtuClient(
runtime, // runtime
"/dev/ttySIM0", // path
new SerialPortSettings(), // serial settings
1, // max queued requests
TimeSpan.FromSeconds(1), // retry delay
decodeLevel // decode level
);
// ANCHOR_END: create_rtu_channel
}

try
{
Expand All @@ -54,7 +72,7 @@ static void Main(string[] args)
private static async Task RunChannel(Channel channel)
{
// ANCHOR: request_param
var param = new RequestParam(1, 1000);
var param = new RequestParam(1, TimeSpan.FromSeconds(1));
// ANCHOR_END: request_param
// ANCHOR: address_range
var range = new AddressRange(0, 5);
Expand Down
19 changes: 15 additions & 4 deletions ffi/bindings/dotnet/examples/server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,21 @@ static void Main(string[] args)
// ANCHOR_END: device_map_init

// create the TCP server
// ANCHOR: tcp_server_create
var decodeLevel = new DecodeLevel();
var server = Server.CreateTcpServer(runtime, "127.0.0.1:502", 10, map, decodeLevel);
// ANCHOR_END: tcp_server_create
Server server = null;
if (Array.IndexOf(args, "--serial") == -1)
{
// ANCHOR: tcp_server_create
var decodeLevel = new DecodeLevel();
server = Server.CreateTcpServer(runtime, "127.0.0.1:502", 100, map, decodeLevel);
// ANCHOR_END: tcp_server_create
}
else
{
// ANCHOR: rtu_server_create
var decodeLevel = new DecodeLevel();
server = Server.CreateRtuServer(runtime, "/dev/ttySIM1", new SerialPortSettings(), map, decodeLevel);
// ANCHOR_END: rtu_server_create
}

try
{
Expand Down
3 changes: 2 additions & 1 deletion ffi/bindings/dotnet/rodbus-tests/IntegrationTest.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;

using rodbus;
using System;
using System.Collections.Generic;
using System.Linq;

Expand Down Expand Up @@ -80,7 +81,7 @@ public class IntegrationTest
private static readonly byte UNIT_ID = 1;
private static readonly ushort NUM_POINTS = 10;
private static readonly string ENDPOINT = "127.0.0.1:20000";
private static readonly RequestParam param = new RequestParam(UNIT_ID, 1000);
private static readonly RequestParam param = new RequestParam(UNIT_ID, TimeSpan.FromSeconds(1));

static void TestReadDiscreteInputs(Channel client)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.time.Duration;
import java.util.Arrays;

// ANCHOR: logging_interface
Expand All @@ -32,11 +33,27 @@ public static void main(String[] args) throws Exception {
Runtime runtime = new Runtime(runtimeConfig);
// ANCHOR_END: runtime_init

// initialize a Modbus TCP client channel
// ANCHOR: create_tcp_channel
DecodeLevel decodeLevel = new DecodeLevel();
Channel channel = Channel.createTcpClient(runtime, "127.0.0.1:502", ushort(100), new RetryStrategy(), decodeLevel);
// ANCHOR_END: create_tcp_channel
// initialize a Modbus client channel
Channel channel = null;
if (!Arrays.asList(args).contains("--serial")) {
// ANCHOR: create_tcp_channel
DecodeLevel decodeLevel = new DecodeLevel();
channel = Channel.createTcpClient(runtime, "127.0.0.1:502", ushort(100), new RetryStrategy(), decodeLevel);
// ANCHOR_END: create_tcp_channel
}
else {
// ANCHOR: create_rtu_channel
DecodeLevel decodeLevel = new DecodeLevel();
channel = Channel.createRtuClient(
runtime,
"/dev/ttySIM0", // path
new SerialPortSettings(), // serial settings
ushort(1), // max queued requests
Duration.ofSeconds(1), // retry delay
decodeLevel // decode level
);
// ANCHOR_END: create_rtu_channel
}

try {
run(channel);
Expand All @@ -49,7 +66,7 @@ public static void main(String[] args) throws Exception {

private static void run(Channel channel) throws Exception {
// ANCHOR: request_param
final RequestParam param = new RequestParam(ubyte(1), uint(1000));
final RequestParam param = new RequestParam(ubyte(1), Duration.ofSeconds(1));
// ANCHOR_END: request_param
// ANCHOR: address_range
final AddressRange range = new AddressRange(ushort(0), ushort(5));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import io.stepfunc.rodbus.*;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.time.Duration;
import java.util.Arrays;
import java.util.List;

import io.stepfunc.rodbus.Runtime;
Expand Down Expand Up @@ -89,10 +91,19 @@ public static void main(String[] args) throws Exception {
});
// ANCHOR_END: device_map_init

// ANCHOR: tcp_server_create
DecodeLevel decodeLevel = new DecodeLevel();
Server server = Server.createTcpServer(runtime, "127.0.0.1:502", ushort(10), map, decodeLevel);
// ANCHOR_END: tcp_server_create
Server server = null;
if (!Arrays.asList(args).contains("--serial")) {
// ANCHOR: tcp_server_create
DecodeLevel decodeLevel = new DecodeLevel();
server = Server.createTcpServer(runtime, "127.0.0.1:502", ushort(100), map, decodeLevel);
// ANCHOR_END: tcp_server_create
}
else {
// ANCHOR: rtu_server_create
DecodeLevel decodeLevel = new DecodeLevel();
server = Server.createRtuServer(runtime, "/dev/ttySIM1", new SerialPortSettings(), map, decodeLevel);
// ANCHOR_END: rtu_server_create
}

try {
run(server);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.joou.*;
import org.junit.jupiter.api.Test;

import java.time.Duration;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ExecutionException;
Expand All @@ -15,7 +16,7 @@

public class IntegrationTest {
static final UByte UNIT_ID = ubyte(1);
static final UInteger TIMEOUT_MS = uint(1000);
static final Duration TIMEOUT = Duration.ofSeconds(1);
static final int NUM_POINTS = 10;
static final String ENDPOINT = "127.0.0.1:20000";

Expand Down Expand Up @@ -93,7 +94,7 @@ public void clientAndServerCommunication() throws ExecutionException, Interrupte
}

private void testReadDiscreteInputs(Channel client) throws ExecutionException, InterruptedException {
RequestParam param = new RequestParam(UNIT_ID, TIMEOUT_MS);
RequestParam param = new RequestParam(UNIT_ID, TIMEOUT);
AddressRange range = new AddressRange(ushort(2), ushort(3));

BitReadResult result = client.readDiscreteInputs(param, range).toCompletableFuture().get();
Expand All @@ -118,7 +119,7 @@ private void testReadDiscreteInputs(Channel client) throws ExecutionException, I
}

private void testReadInputRegisters(Channel client) throws ExecutionException, InterruptedException {
RequestParam param = new RequestParam(UNIT_ID, TIMEOUT_MS);
RequestParam param = new RequestParam(UNIT_ID, TIMEOUT);
AddressRange range = new AddressRange(ushort(3), ushort(3));

RegisterReadResult result = client.readInputRegisters(param, range).toCompletableFuture().get();
Expand All @@ -143,7 +144,7 @@ private void testReadInputRegisters(Channel client) throws ExecutionException, I
}

private void testWriteSingleCoil(Channel client) throws ExecutionException, InterruptedException {
RequestParam param = new RequestParam(UNIT_ID, TIMEOUT_MS);
RequestParam param = new RequestParam(UNIT_ID, TIMEOUT);
Bit bit = new Bit(ushort(1), true);

ErrorInfo writeResult = client.writeSingleCoil(param, bit).toCompletableFuture().get();
Expand All @@ -164,7 +165,7 @@ private void testWriteSingleCoil(Channel client) throws ExecutionException, Inte
}

private void testWriteSingleRegister(Channel client) throws ExecutionException, InterruptedException {
RequestParam param = new RequestParam(UNIT_ID, TIMEOUT_MS);
RequestParam param = new RequestParam(UNIT_ID, TIMEOUT);
Register register = new Register(ushort(1), ushort(22));

ErrorInfo writeResult = client.writeSingleRegister(param, register).toCompletableFuture().get();
Expand All @@ -185,7 +186,7 @@ private void testWriteSingleRegister(Channel client) throws ExecutionException,
}

private void testWriteMultipleCoils(Channel client) throws ExecutionException, InterruptedException {
RequestParam param = new RequestParam(UNIT_ID, TIMEOUT_MS);
RequestParam param = new RequestParam(UNIT_ID, TIMEOUT);

ErrorInfo writeResult = client.writeMultipleCoils(param, ushort(0), Arrays.asList(true, false, true)).toCompletableFuture().get();
assertThat(writeResult.summary).isEqualTo(Status.OK);
Expand All @@ -207,7 +208,7 @@ private void testWriteMultipleCoils(Channel client) throws ExecutionException, I
}

private void testWriteMultipleRegisters(Channel client) throws ExecutionException, InterruptedException {
RequestParam param = new RequestParam(UNIT_ID, TIMEOUT_MS);
RequestParam param = new RequestParam(UNIT_ID, TIMEOUT);

ErrorInfo writeResult = client.writeMultipleRegisters(param, ushort(0), Arrays.asList(ushort(0xCAFE), ushort(21), ushort(0xFFFF))).toCompletableFuture().get();
assertThat(writeResult.summary).isEqualTo(Status.OK);
Expand Down