Skip to main content

Creating associations

An association is how the master talks to one outstation on a channel. Add one to a MasterChannel with addAssociation (add_association in Rust), and supply:

What you supplyWhat it does
Outstation addressWhich outstation on the channel the association talks to
AssociationConfigThe startup sequence, time synchronization, how the master reacts to the outstation, and timeouts
ReadHandlerReceives every value the outstation reports
AssociationHandlerSupplies the time for time synchronization
AssociationInformationReports the start and outcome of each task
let association = channel
.add_association(
outstation_address,
get_association_config(),
Box::new(ExampleReadHandler),
Box::new(ExampleAssociationHandler),
Box::new(ExampleAssociationInformation),
)
.await?;

Each outstation address can be used once per channel: the master rejects a second association with the same address.

On a UDP channel, use addUdpAssociation (add_udp_association in Rust), which also takes the outstation's endpoint; see UDP.

Removing​

An association stays on the channel until you remove it, even if you discard what addAssociation returned. Remove it with removeAssociation on the MasterChannel (in Rust, remove on the association or remove_association on the channel). This stops its polls and automatic tasks, and any of its requests still waiting in the queue fail.