#[non_exhaustive]pub struct ControllerCtx {
pub op_name: String,
pub op_dir: PathBuf,
pub dt_ns: u32,
pub timeout_to_operating_ns: u32,
pub binding_timeout_ms: u16,
pub configuring_timeout_ms: u16,
pub peripheral_loss_of_contact_limit: u16,
pub controller_loss_of_contact_limit: u16,
pub termination_criteria: Vec<Termination>,
pub loss_of_contact_policy: LossOfContactPolicy,
pub user_ctx: BTreeMap<String, String>,
pub user_channels: Arc<RwLock<BTreeMap<String, Channel>>>,
}
Expand description
Operation context, provided to appendages during init
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.op_name: String
A name for this controller op, which will be used as the name of the file/table/bucket/etc of each data dispatcher and must be compatible with that use.
op_dir: PathBuf
A directory to find file inputs and place outputs.
dt_ns: u32
Control cycle period in nanoseconds
timeout_to_operating_ns: u32
Delay from end of configuration window after which the peripherals time out to the Operating state
binding_timeout_ms: u16
Duration to wait for responses to binding
configuring_timeout_ms: u16
Duration for peripherals to wait to receive configuration after being bound
peripheral_loss_of_contact_limit: u16
Number of consecutive missed control inputs after which the peripheral should assume contact has been lost, de-energize their outputs, and wait to bind a controller again.
controller_loss_of_contact_limit: u16
Number of consecutive missed responses from a peripheral after which the controller should assume contact has been lost
termination_criteria: Vec<Termination>
A set of conditions for exiting the control loop, to be checked at each cycle
loss_of_contact_policy: LossOfContactPolicy
Response to losing contact with a peripheral
user_ctx: BTreeMap<String, String>
An escape hatch for sideloading user context (likely json-encoded) that is not yet implemented as a standalone field.
user_channels: Arc<RwLock<BTreeMap<String, Channel>>>
An escape hatch for sideloading communication between appendages. Each channel is a bidirectional MPMC message pipe.
Because bidirectional channels may not close until the program terminates on its own, the status of these channels should not be used to indicate when a freerunning thread should terminate, as this will often result in a resource leak.
Implementations§
Source§impl ControllerCtx
impl ControllerCtx
Sourcepub fn source_endpoint(&self, channel_name: &str) -> Endpoint
pub fn source_endpoint(&self, channel_name: &str) -> Endpoint
Get a handle to a source endpoint tx/rx pair for the channel, creating the channel if it does not exist.
Sourcepub fn sink_endpoint(&self, channel_name: &str) -> Endpoint
pub fn sink_endpoint(&self, channel_name: &str) -> Endpoint
Get a handle to a sink endpoint tx/rx pair for the channel, creating the channel if it does not exist.
Trait Implementations§
Source§impl Clone for ControllerCtx
impl Clone for ControllerCtx
Source§fn clone(&self) -> ControllerCtx
fn clone(&self) -> ControllerCtx
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more