SimConnectObject

Derive Macro SimConnectObject 

Source
#[derive(SimConnectObject)]
{
    // Attributes available to this derive:
    #[simconnect]
}
Expand description

SimConnectObject derive macro.

§Struct Arguments

  • period - Required. One of once, visual-frame, sim-frame, second.
  • condition - Optional. Defaults to none. The condition of the data. Must be either none or changed. changed = Data will only be sent to the client when one or more values have changed. All the variables in a data definition will be returned if just one of the values changes.
  • interval - Optional. Defaults to 0. The number of period events that should elapse between transmissions of the data. 0 means the data is transmitted every Period, 1 means that the data is transmitted every other Period, etc.

§Field Arguments

§Example


#[derive(Debug, Clone, SimConnectObject)]
#[simconnect(period = "second")]
struct AirplaneData {
    #[simconnect(name = "TITLE")]
    title: String,
    #[simconnect(name = "CATEGORY")]
    category: String,
    #[simconnect(name = "PLANE LATITUDE", unit = "degrees")]
    lat: f64,
    #[simconnect(name = "PLANE LONGITUDE", unit = "degrees")]
    lon: f64,
    #[simconnect(name = "PLANE ALTITUDE", unit = "feet")]
    alt: f64,
    #[simconnect(name = "SIM ON GROUND", unit = "bool")]
    sim_on_ground: bool,
}