[][src]Struct lrl_test_compiler::environment::config::Config

pub struct Config {
    pub relay_micros: u32,
    pub sensor_micros: u32,
    pub max_segment_length_micros: u32,
    pub safe_state: Vec<String>,
    pub drivers_path: Option<PathBuf>,
    pub relays: HashMap<String, RelayRecord>,
    pub sensors: HashMap<String, SensorRecord>,
    pub virtuals: Virtual,
    pub global_bounds: Option<HashMap<String, ConfigSensorBound>>,
}

Represents a configuration TOML file.

Fields

relay_micros: u32

Maximum micro seconds to process a relay statement

sensor_micros: u32

Maximum micro seconds to process a sensor statement

max_segment_length_micros: u32

Maximum micro seconds to process an entire segment

safe_state: Vec<String>

A vector of relay names for firmware to set in the safe state

drivers_path: Option<PathBuf>

Path to drivers.toml

relays: HashMap<String, RelayRecord>

The mapping from relay name to relay device address

sensors: HashMap<String, SensorRecord>

The mapping from sensor name to sensor metadata

virtuals: Virtual

Mapping to virtual sensors and relays

global_bounds: Option<HashMap<String, ConfigSensorBound>>

The mapping from sensor name to a global bound

Implementations

impl Config[src]

pub fn get_sensor_device_address(
    &self,
    sensor_id: &str
) -> CompilerResult<DeviceAddress>
[src]

Convert sensor id used in TDF file to virtual address

pub fn get_relay_device_address(
    &self,
    relay_id: &str
) -> CompilerResult<DeviceAddress>
[src]

Convert relay id used in TDF file to virtual address

pub fn get_safe_state_relay_records(&self) -> Vec<&RelayRecord>[src]

Function to get a vector containing every physical relay record for relays in the safe state

pub fn get_safe_state_v_relay_records(&self) -> Vec<&VirtualRelayRecord>[src]

Function to get a vector containing every virtual relay record for relays in the safe state

pub fn get_relay_records(&self) -> Vec<&RelayRecord>[src]

Function to get a vector of every relay record in the config.toml. The vector is output in sorted order by device address values

pub fn get_sensor_records(&self) -> Vec<&SensorRecord>[src]

Function to get a vector of every sensor record in the config.toml. The vector is output in sorted order by device address values

pub fn get_v_relay_records(&self) -> Vec<&VirtualRelayRecord>[src]

Function to get a vector of every virtual relay record in the config.toml. The vector is output in sorted order by device address values

pub fn get_v_sensor_records(&self) -> Vec<&VirtualSensorRecord>[src]

Function to get a vector of every virtual sensor record in the config.toml. The vector is output in sorted order by device address values

pub fn validate_device_addresses(
    &self,
    file_name: &String
) -> CompilerResult<()>
[src]

Function to validate that no physical relay or sensor shares the same device address value.

pub fn validate_v_device_addresses(
    &self,
    file_name: &String
) -> CompilerResult<()>
[src]

Function to validate that device addresses are valid and no virtual relay or sensor shares the same device address value.

fn validate_device_address_values(
    device_addresses: Vec<ConfigDeviceAddress>,
    file_name: &String
) -> CompilerResult<()>
[src]

Validate that every channel value in the config is no more than 3 bits large

fn find_duplicate_device_address_values(
    device_addresses1: Vec<u16>,
    device_addresses2: Vec<u16>
) -> HashSet<u16>
[src]

Return the duplicated device addresses provided across both vectors

pub fn validate_device_ids(&self, file_name: &String) -> CompilerResult<()>[src]

Function to ensure all device ids in the config.toml do not violate any naming constraints such as an identical relay or sensor name

pub fn validate_safe_state(&mut self, file_name: &String) -> CompilerResult<()>[src]

Function to ensure every relay in the safe state actually exists

pub fn validate_global_bounds(
    &mut self,
    file_name: &String
) -> CompilerResult<()>
[src]

Function to ensure every sensor in the global bounds actually exists

fn find_missing<T: Clone + Hash + Eq>(
    to_check: Vec<T>,
    given_values: Vec<T>
) -> HashSet<T>
[src]

Given a vector of given values and a second vector, returns all values in the to_check vector that do not exist in the given_values vector.

Trait Implementations

impl Debug for Config[src]

impl<'de> Deserialize<'de> for Config[src]

impl PartialEq<Config> for Config[src]

impl StructuralPartialEq for Config[src]

Auto Trait Implementations

impl RefUnwindSafe for Config

impl Send for Config

impl Sync for Config

impl Unpin for Config

impl UnwindSafe for Config

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<Src, Dst> LosslessTryInto<Dst> for Src where
    Dst: LosslessTryFrom<Src>, 
[src]

impl<Src, Dst> LossyInto<Dst> for Src where
    Dst: LossyFrom<Src>, 
[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]