Skip to content

Commit

Permalink
feat(send_custom_fc): add standard FC routing for a CFC request in me…
Browse files Browse the repository at this point in the history
…ssage
  • Loading branch information
dkoehler-dev committed Mar 12, 2024
1 parent 2d1ccab commit 14e6134
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions rodbus/src/client/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,16 @@ impl RequestDetails {
RequestDetails::WriteMultipleRegisters(_) => Ok(FunctionCode::WriteMultipleRegisters),
RequestDetails::SendCustomFunctionCode(x) => {
match x.request.function_code() {
// Standard FCs
0x01 => Ok(FunctionCode::ReadCoils),
0x02 => Ok(FunctionCode::ReadDiscreteInputs),
0x03 => Ok(FunctionCode::ReadHoldingRegisters),
0x04 => Ok(FunctionCode::ReadInputRegisters),
0x05 => Ok(FunctionCode::WriteSingleCoil),
0x06 => Ok(FunctionCode::WriteSingleRegister),
0x0F => Ok(FunctionCode::WriteMultipleCoils),
0x10 => Ok(FunctionCode::WriteMultipleRegisters),
// Custom FCs
0x41 => Ok(FunctionCode::SendCFC65),
0x42 => Ok(FunctionCode::SendCFC66),
0x43 => Ok(FunctionCode::SendCFC67),
Expand Down

0 comments on commit 14e6134

Please sign in to comment.