#[derive(SimConnectObject)]
{
// Attributes available to this derive:
#[simconnect]
}
Expand description
SimConnectObject derive macro.
§Struct Arguments
period- Required. One ofonce,visual-frame,sim-frame,second.condition- Optional. Defaults tonone. The condition of the data. Must be eithernoneorchanged.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 to0. The number of period events that should elapse between transmissions of the data.0means the data is transmitted every Period,1means that the data is transmitted every other Period, etc.
§Field Arguments
name- Required. The name of the field. One from https://www.prepar3d.com/SDKv5/sdk/references/variables/simulation_variables.html.unit- Optional. The unit of the field. Forstrings andbools it should be left out or be empty string. For numeric fields it should be one from https://www.prepar3d.com/SDKv5/sdk/references/variables/simulation_variables.html.
§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,
}