You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by jf...@apache.org on 2022/06/02 12:56:05 UTC
[plc4x] branch feature/plc4rs updated: Added NoOption struct
This is an automated email from the ASF dual-hosted git repository.
jfeinauer pushed a commit to branch feature/plc4rs
in repository https://gitbox.apache.org/repos/asf/plc4x.git
The following commit(s) were added to refs/heads/feature/plc4rs by this push:
new 3368f129c3 Added NoOption struct
3368f129c3 is described below
commit 3368f129c35d4351f2b19be1402560ab6aa943ac
Author: julian <j....@pragmaticminds.de>
AuthorDate: Thu Jun 2 14:55:59 2022 +0200
Added NoOption struct
---
plc4rust/README.md | 2 --
plc4rust/src/lib.rs | 2 ++
plc4rust/src/modbus/driver_type.rs | 4 ++--
plc4rust/src/modbus/modbus_adu.rs | 4 ++--
plc4rust/src/modbus/modbus_pdu.rs | 4 ++--
plc4rust/src/modbus/modbus_pdu_read_file_record_request_item.rs | 4 ++--
plc4rust/src/modbus/modbus_pdu_write_file_record_response_item.rs | 4 ++--
7 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/plc4rust/README.md b/plc4rust/README.md
index 9b95cffe10..a989ba493f 100644
--- a/plc4rust/README.md
+++ b/plc4rust/README.md
@@ -6,5 +6,3 @@ Some testing / prototyping for potential plc4rust
cargo 1.59.0
rust 1.59.0
-
-
diff --git a/plc4rust/src/lib.rs b/plc4rust/src/lib.rs
index 6b7994d148..0a41a1912f 100644
--- a/plc4rust/src/lib.rs
+++ b/plc4rust/src/lib.rs
@@ -16,6 +16,8 @@ pub enum Endianess {
BigEndian
}
+struct NoOption {}
+
trait Message {
type M;
type P;
diff --git a/plc4rust/src/modbus/driver_type.rs b/plc4rust/src/modbus/driver_type.rs
index 4515a62d37..f6cac2cff5 100644
--- a/plc4rust/src/modbus/driver_type.rs
+++ b/plc4rust/src/modbus/driver_type.rs
@@ -1,5 +1,5 @@
use std::io::{Error, ErrorKind, Read, Write};
-use crate::{Message, ReadBuffer, WriteBuffer};
+use crate::{Message, NoOption, ReadBuffer, WriteBuffer};
// [enum DriverType
// ['0x01' MODBUS_TCP ]
@@ -53,7 +53,7 @@ impl Into<u8> for DriverType {
impl Message for DriverType {
type M = DriverType;
- type P = u8;
+ type P = NoOption;
fn get_length_in_bits(&self) -> u32 {
8
diff --git a/plc4rust/src/modbus/modbus_adu.rs b/plc4rust/src/modbus/modbus_adu.rs
index 137504771a..2d18011d2e 100644
--- a/plc4rust/src/modbus/modbus_adu.rs
+++ b/plc4rust/src/modbus/modbus_adu.rs
@@ -1,6 +1,6 @@
use std::io::{Error, Read, Write};
use std::io::ErrorKind::InvalidInput;
-use crate::{Message, ReadBuffer, WriteBuffer};
+use crate::{Message, NoOption, ReadBuffer, WriteBuffer};
use crate::modbus::{DriverType, ModbusPDU};
// [discriminatedType ModbusADU(DriverType driverType, bit response) byteOrder='BIG_ENDIAN'
@@ -125,7 +125,7 @@ pub struct ModbusRtuADU {
impl Message for ModbusRtuADU {
type M = ModbusRtuADU;
- type P = u8;
+ type P = NoOption;
fn get_length_in_bits(&self) -> u32 {
todo!()
diff --git a/plc4rust/src/modbus/modbus_pdu.rs b/plc4rust/src/modbus/modbus_pdu.rs
index ad0bea13b7..b664cb77e8 100644
--- a/plc4rust/src/modbus/modbus_pdu.rs
+++ b/plc4rust/src/modbus/modbus_pdu.rs
@@ -1,5 +1,5 @@
use std::io::{Error, Read, Write};
-use crate::{Message, ReadBuffer, WriteBuffer};
+use crate::{Message, NoOption, ReadBuffer, WriteBuffer};
// [discriminatedType ModbusPDU(bit response)
// [discriminator bit errorFlag]
@@ -239,7 +239,7 @@ pub struct ModbusPDUError {
impl Message for ModbusPDUError {
type M = ModbusPDUError;
- type P = u8;
+ type P = NoOption;
fn get_length_in_bits(&self) -> u32 {
todo!()
diff --git a/plc4rust/src/modbus/modbus_pdu_read_file_record_request_item.rs b/plc4rust/src/modbus/modbus_pdu_read_file_record_request_item.rs
index 3635d649ee..010696cdde 100644
--- a/plc4rust/src/modbus/modbus_pdu_read_file_record_request_item.rs
+++ b/plc4rust/src/modbus/modbus_pdu_read_file_record_request_item.rs
@@ -1,5 +1,5 @@
use std::io::{Read, Write};
-use crate::{Message, ReadBuffer, WriteBuffer};
+use crate::{Message, NoOption, ReadBuffer, WriteBuffer};
// [type ModbusPDUReadFileRecordRequestItem
// [simple uint 8 referenceType]
@@ -17,7 +17,7 @@ pub struct ModbusPDUReadFileRecordRequestItem {
impl Message for ModbusPDUReadFileRecordRequestItem {
type M = ModbusPDUReadFileRecordRequestItem;
- type P = u8;
+ type P = NoOption;
fn get_length_in_bits(&self) -> u32 {
56*8
diff --git a/plc4rust/src/modbus/modbus_pdu_write_file_record_response_item.rs b/plc4rust/src/modbus/modbus_pdu_write_file_record_response_item.rs
index 7ef2a82a6a..cd4682e659 100644
--- a/plc4rust/src/modbus/modbus_pdu_write_file_record_response_item.rs
+++ b/plc4rust/src/modbus/modbus_pdu_write_file_record_response_item.rs
@@ -1,5 +1,5 @@
use std::io::{Read, Write};
-use crate::{Message, ReadBuffer, WriteBuffer};
+use crate::{Message, NoOption, ReadBuffer, WriteBuffer};
// [type ModbusPDUWriteFileRecordResponseItem
// [simple uint 8 referenceType]
@@ -24,7 +24,7 @@ impl ModbusPDUWriteFileRecordResponseItem {
impl Message for ModbusPDUWriteFileRecordResponseItem {
type M = ModbusPDUWriteFileRecordResponseItem;
- type P = u8;
+ type P = NoOption;
fn get_length_in_bits(&self) -> u32 {
8 * (56 + self.record_data.len()) as u32