Skip to content

Commit 496bb80

Browse files
committed
update README.md
1 parent c9bcdaf commit 496bb80

1 file changed

Lines changed: 89 additions & 29 deletions

File tree

README.md

Lines changed: 89 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# **ethernetip‑rs**
22

33
A Rust implementation of the EtherNet/IP™ protocol for symbolic tag access on Allen‑Bradley ControlLogix and CompactLogix PLCs.
4-
The library provides an async API for reading and writing CIP tags, including typed accessors, arrays, fragmented reads, multi‑tag operations, EPATH encoding, and optional slot routing.
4+
The library provides an async API for reading and writing CIP tags, including typed accessors, arrays, fragmented reads, multi‑tag operations, EPATH encoding, slot routing, and generic CIP object access.
55

66
---
77

@@ -10,46 +10,78 @@ The library provides an async API for reading and writing CIP tags, including ty
1010
`ethernetip-rs` implements unconnected and connected CIP explicit messaging for Rockwell Logix controllers.
1111
The client supports SendRRData and Class‑3 connected messaging through Forward Open / Forward Close and SendUnitData.
1212
It works with CompactLogix (no routing) and ControlLogix (CPU in a chassis slot).
13-
A deterministic fake PLC is included for development and testing.
13+
A deterministic fake PLC is included for development and CI.
1414

15-
### Features
15+
In addition to symbolic tag access, the library supports **generic CIP object reads**, including:
1616

17+
- Identity Object (class 0x01)
18+
- Connection Manager (class 0x06)
19+
- Any class/instance/attribute via GetAttributeSingle / GetAttributeAll
20+
21+
This enables diagnostics and metadata retrieval from both Logix and non‑Logix CIP devices.
22+
23+
---
24+
25+
## Features
26+
27+
### Tag access
1728
- Typed tag access:
1829
- `read_bool`, `read_sint`, `read_int`, `read_dint`, `read_real`, `read_string`
1930
- `write_bool`, `write_sint`, `write_int`, `write_dint`, `write_real`, `write_string`
2031
- Raw tag access (`read_tag`, `write_tag`)
2132
- Array reads:
22-
- single‑packet reads for small arrays
33+
- single‑packet reads
2334
- CIP Fragmented Read (0x52) for large arrays
2435
- Array writes
2536
- Multiple Service Packet (MSP) multi‑tag read
26-
- Correct CIP EPATH encoding:
37+
38+
### CIP object access
39+
- Generic object attribute reads:
40+
- `read_object_attribute(class, instance, attribute)`
41+
- `read_object_attributes(class, instance)`
42+
- Identity Object support:
43+
- `read_identity()`
44+
- `IdentityInfo` decoding (vendor ID, product code, revision, serial, product name)
45+
- Connection Manager diagnostics:
46+
- `read_connection_manager()`
47+
- `ConnectionManagerInfo` decoding (state, watchdog timeout, transport class, etc.)
48+
49+
### Protocol correctness
50+
- Full CIP EPATH encoding:
2751
- symbolic segments
2852
- array indices
2953
- multi‑index
3054
- struct members
3155
- slot routing
3256
- Async API using `tokio`
33-
- Fake PLC for integration tests
34-
- Deterministic behavior for CI
3557
- Connected explicit messaging (Class 3):
36-
- Forward Open / Forward Close
37-
- Large Forward Open (0x5B) / Large Forward Close (0x5E)
38-
- SendUnitData transport
39-
- connection ID and sequence counter tracking
40-
- automatic routing over RR‑Data or Unit‑Data
58+
- Forward Open / Forward Close
59+
- Large Forward Open (0x5B) / Large Forward Close (0x5E)
60+
- SendUnitData transport
61+
- connection ID and sequence counter tracking
62+
- automatic routing over RR‑Data or Unit‑Data
63+
64+
### Testing
65+
- Fake PLC for integration tests
66+
- Deterministic behavior for CI
67+
- Unit tests for:
68+
- CIP builders
69+
- EPATH encoding
70+
- IdentityInfo decoding
71+
- ConnectionManagerInfo decoding
72+
- default trait implementations for object access
4173

4274
---
4375

4476
## Supported CIP types
4577

46-
- BOOL (including packed BOOL arrays)
47-
- SINT
48-
- INT
49-
- DINT
50-
- LINT
51-
- REAL
52-
- STRING
78+
- BOOL (including packed BOOL arrays)
79+
- SINT
80+
- INT
81+
- DINT
82+
- LINT
83+
- REAL
84+
- STRING
5385

5486
Typed helpers validate the returned CIP type and return
5587
`CipError::TypeMismatch { expected, actual }` when the PLC tag type differs.
@@ -92,7 +124,9 @@ async fn main() -> anyhow::Result<()> {
92124
}
93125
```
94126

95-
### Raw API
127+
---
128+
129+
## Raw API
96130

97131
```rust
98132
use ethernetip::types::CipValue;
@@ -123,7 +157,7 @@ Handles:
123157
- partial transfer status (0x06)
124158
- offset increments
125159
- fragment concatenation
126-
- decoding into `Vec<CipValue>`
160+
- decoding into `Vec<CipValue>`
127161

128162
---
129163

@@ -160,9 +194,35 @@ MSP batches multiple CIP requests into one round trip.
160194

161195
---
162196

197+
## CIP object access examples
198+
199+
### Identity Object
200+
201+
```rust
202+
let info = client.read_identity().await?;
203+
println!("Product: {} v{}.{}", info.product_name, info.major, info.minor);
204+
```
205+
206+
### Connection Manager
207+
208+
```rust
209+
let cm = client.read_connection_manager().await?;
210+
println!("Connection state: {:?}", cm.state);
211+
```
212+
213+
---
214+
163215
## Fake PLC for testing
164216

165-
The test suite includes coverage for CIP request builders, Forward Open, Large Forward Open, and all EPATH variants.
217+
The fake PLC simulates:
218+
219+
- tag reads and writes
220+
- fragmented reads
221+
- MSP
222+
- Forward Open / Forward Close
223+
- EPATH parsing
224+
225+
Used extensively in CI to ensure deterministic behavior.
166226

167227
---
168228

@@ -176,13 +236,13 @@ cargo run
176236

177237
## Future improvements
178238

179-
- Additional connection types
180-
- Automatic reconnect for connected sessions
181-
- Implicit I/O (UDP)
182-
- Class/instance/attribute access for non‑Logix devices
183-
- More realistic fake PLC behavior
184-
- Retry and backoff logic
185-
- Benchmarks for MSP and array operations
239+
- Additional connection types
240+
- Automatic reconnect for connected sessions
241+
- Implicit I/O (UDP)
242+
- More CIP object models
243+
- More realistic fake PLC behavior
244+
- Retry and backoff logic
245+
- Benchmarks for MSP and array operations
186246

187247
---
188248

0 commit comments

Comments
 (0)