m-bus-parser 0.0.0

A library for parsing M-Bus frames
Documentation

m-bus-parser

A modern, open source parser for wired m-bus portocol according to EN 13757-2 (contains physical and link layer specificatioin) and EN 13757-3 (contains application layer specification).

Important links

Goals

Example of function

Examples taken from https://m-bus.com/documentation-wired/06-application-layer:

  1. Set the slave to primary address 8 without changing anything else:

INPUT: 68 06 06 68 | 53 FE 51 | 01 7A 08 | 25 16

Parsing the frame using the library (the data is not yet parsable with the lib):

   
    use m_bus_parser::frames::{Address, Frame, Function};

    let example = vec![ 
        0x68, 0x06, 0x06, 0x68, 
        0x53, 0xFE, 0x51, 
        0x01, 0x7A, 0x08, 
        0x25, 0x16,
    ];

    let frame = Frame::try_from(example.as_slice())).unwrap();

    if let Frame::ControlFrame { function, address, data } = frame {
        assert_eq!(address, Address::Broadcast { reply_required: true });
        assert_eq!(function, Function::SndUd { fcb: (false)});
        assert_eq!(data, &[0x51,0x01, 0x7A, 0x08]);
    }

OSZAR »