bacnet-npdu
The BACnet network-layer vocabulary from Clause 6 of ASHRAE 135, for
rusty-bacnet: one definition
of each concept, shared by the portable cores (bacnet-mstp-core,
bacnet-bip-core, bacnet-router-core), the hosted transports and network
layer, and the owned NPDU codec of bacnet-encoding.
#![no_std], no allocator, no dependencies.Npdu: a borrowed view of an NPDU's control information and payload.Npdu::decodereads one in place and reports an address too long for any data link apart from every other fault, with what a router needs to address its reject;Npdu::encoded_lenandNpdu::encode_intowrite one into your buffer, refusing anything the decoder refuses before writing an octet.NetworkMessageTypeandRejectMessageReason: open sets of wire codes with named constants. Any octet converts, so amatchon them needs a wildcard arm.RejectMessageToNetwork: a reject's reason and network, read and written in place;RejectLengthErrorrefuses data that isn't three octets.NetworkPriority: the closed, two-bit network priority.NpduLimitsandMAX_NPDU(1,497 octets): the longest NPDU a link carries each way.MacandMAX_MAC_LEN(18 octets): a link-layer address stored inline.
Example
use ;
// What-Is-Network-Number, for the local network.
let question = message;
let mut frame = ;
let len = question.encode_into?;
assert_eq!;
// A routed APDU, read in place.
let routed = ;
let npdu = decode.expect;
assert_eq!;
assert_eq!;
assert!;
# Ok::
License
MIT