bacnet-services
BACnet service request and response parameter codecs for the Rusty BACnet workspace. Each module provides structures and byte encoders/decoders for a service family. Property values at constructed boundaries remain raw bytes for the application to interpret. This crate does not perform network requests or operate a device.
Quickstart from development source
Use a checkout named rusty-bacnet beside your application directory. These
blocks describe development-source dependencies, not the contents of a published
release. The example imports bacnet-types directly, so it is listed too, and
bytes is there for the BytesMut encoders mentioned after it. Adjust the
paths for another layout.
[]
= { = "../rusty-bacnet/crates/bacnet-services" }
= { = "../rusty-bacnet/crates/bacnet-types" }
= "1"
Encode and decode ReadProperty service parameters. These are only the service body: no confirmed-request APDU, NPDU, transport frame or device interaction is created by this example.
use ReadPropertyRequest;
use ;
use ObjectIdentifier;
With alloc, request.encode(&mut wire) appends the same octets to a
bytes::BytesMut.
Without an allocator
Who-Is, I-Am and ReadProperty (request and ACK) encode into the caller's
storage and decode from borrowed octets with neither std nor alloc
(#1614). ReadPropertyAckRef borrows the property value in place of the owned
ACK's Vec:
use ReadPropertyAckRef;
use ;
Features and allocation
The crate has three profiles. With neither std nor alloc it builds without
an allocator, with the services above only.
| Profile | Features | What it has |
|---|---|---|
| Hosted | std (default) |
Every service; enables alloc and standard-library support in bacnet-types, bacnet-encoding and bytes. |
no_std with a heap |
alloc |
Every service; enables the foundation crates' alloc profiles. Firmware must supply a global allocator. |
| No allocator | neither | who_is and read_property: their encode_to_sink and decode, and ReadPropertyAckRef. The BytesMut encoders, the owned ReadPropertyACK and every other service need alloc. |
For alloc-only dependencies, replace the entire dependency block, disabling
defaults on every directly listed foundation crate and on bytes:
[]
= { = "../rusty-bacnet/crates/bacnet-services", = false, = ["alloc"] }
= { = "../rusty-bacnet/crates/bacnet-types", = false, = ["alloc"] }
= { = "1", = false }
The same example executes on a host with either block. Firmware additionally
supplies an allocator and a compatible bytes atomic backend. A target without
atomic compare-and-swap, such as ARMv6-M, needs bytes's extra-platforms
feature and a firmware-selected portable-atomic backend. The block above does
not choose that backend. For a build without an allocator, depend on
bacnet-services and bacnet-types with default-features = false and no
features, and leave out bytes, which that profile doesn't use. CI builds each
profile for ARMv6-M, ARMv7E-M and RISC-V (scripts/ci/check-no-std.sh) but
doesn't run it there. Cargo features are additive; another dependency can still
enable alloc or std.
API documentation
This README is also the crate's Rust documentation landing page. The docs.rs
profile explicitly enables std, disables implicit defaults, and renders only
the default x86_64-unknown-linux-gnu target. It exposes the actual hosted API
without bypassing feature gates or claiming firmware qualification.