Expand description
mDNS/DNS-SD discovery of a local VTN.
[Def §Discovery and Configuration of Local VTNs]. A VEN inside a customer site — a heat pump,
a charge point, a gateway — SHOULD be able to find the VTN on the same network without being
told a URL, and a VTN intended for that site SHOULD advertise itself. It is the half of the
single-binary deployment that SQLite starts and this finishes: one process, one file, and a VEN
that finds it.
The specification is unusually concrete here — a service type, six TXT keys and their exact
spellings — so this module is split the same way the rest of the crate is: the part that decides
what is said is pure and exhaustively tested (VtnService), and the part that puts it on a
socket is a thin wrapper over mdns-sd. A test for “does the TXT record say the right thing”
must not need a multicast group.
use openadr::discovery::{Advertisement, VtnService};
// On the VTN: announce this server to the local network.
let service = VtnService::new("my-vtn", 3000).with_program_names(["local-tariff"]);
let _handle = Advertisement::start(&service)?;Everything here happens before any OpenADR communication: discovery does not change the protocol, and a VEN that was given a URL never needs it.
Modules§
- txt
- TXT keys, spelled exactly as the specification spells them.
Structs§
- Advertisement
mdns - A live mDNS advertisement. Dropping it withdraws the service.
- VtnService
- A VTN as it appears on the local network.
Enums§
- Discovery
Error - Why discovery could not be started or read.
Constants§
- SERVICE_
TYPE - The DNS-SD service type OpenADR 3 registers
[Def §Discovery].
Functions§
- discover
mdns - Browse for local VTNs for
timeout, returning what answered.