1 unstable release
0.1.3 | Jun 20, 2022 |
---|
#39 in #scada
Used in 3 crates
(2 directly)
38KB
544 lines
secop-rs
A Rust framework and demo devices for a hardware server speaking the SECoP protocol.
Build/run
Install the Rust toolchain, currently the nightly channel is required.
Debug mode (faster compilation): cargo run -- test.cfg
.
Release mode (optimized for speed): cargo run --release -- test.cfg
.
Organization
The code is (currently) split into four crates:
secop-core
provides the meat of the framework, and server implementationsecop-derive
(which has to be separate as a proc-macro crate) helps the framework by auto-generating interface boilerplatesecop-modules
contains concrete modulessecop
just has the main executable(s)
lib.rs
:
Derive support for secop modules
There are two auto-derive traits implemented here:
-
ModuleBase
is a complete implementation of the guts of a module. It provides an easy DSL to add parameters and commands, and translates that into the respective case handling in the methods that implement the basic SECoP actions likechange
anddo
.It also provides automatic translation and verification between JSON payloads and Rust data for parameter and argument types.
-
TypeDesc
can be derived for enums and structs, and provides a type- safe way to declare parameters and commands with enum and struct datatypes.
Dependencies
~2MB
~45K SLoC