Skip to main content

simconnect_sdk/domain/
period.rs

1use crate::bindings;
2
3/// Specifies how often the data is to be sent by the server and received by the client.
4/// 0 - every interval.
5/// 1 - every other interval.
6/// 2 - every third interval.
7/// etc.
8#[derive(Debug, Clone, PartialEq, Eq)]
9pub enum Period {
10    /// Specifies that the data should be sent once only. Note that this is not an efficient way of receiving data frequently, use one of the other periods if there is a regular frequency to the data request.
11    Once,
12    /// Specifies that the data should be sent every visual (rendered) frame.
13    VisualFrame,
14    /// Specifies that the data should be sent every simulated frame, whether that frame is rendered or not.
15    SimFrame,
16    /// Specifies that the data should be sent once every second.
17    Second,
18}
19
20impl From<Period> for i32 {
21    fn from(period: Period) -> Self {
22        match period {
23            Period::Once => bindings::SIMCONNECT_PERIOD_SIMCONNECT_PERIOD_ONCE,
24            Period::VisualFrame => bindings::SIMCONNECT_PERIOD_SIMCONNECT_PERIOD_VISUAL_FRAME,
25            Period::SimFrame => bindings::SIMCONNECT_PERIOD_SIMCONNECT_PERIOD_SIM_FRAME,
26            Period::Second => bindings::SIMCONNECT_PERIOD_SIMCONNECT_PERIOD_SECOND,
27        }
28    }
29}