#[derive(Clone, Copy, PartialEq, PartialOrd, Ord, Eq, Hash, Debug, Default)]
#[non_exhaustive]
#[repr(u16)]
pub enum SimulationControlsUsage {
#[default]
Undefined,
FlightSimulationDevice,
AutomobileSimulationDevice,
TankSimulationDevice,
SpaceshipSimulationDevice,
SubmarineSimulationDevice,
SailingSimulationDevice,
MotorcycleSimulationDevice,
SportsSimulationDevice,
AirplaneSimulationDevice,
HelicopterSimulationDevice,
MagicCarpetSimulationDevice,
BicycleSimulationDevice,
Reserved0D_1F(u16),
FlightControlStick = 32,
FlightStick,
CyclicControl,
CyclicTrim,
FlightYoke,
TrackControl,
Reserved26_AF(u16),
Aileron = 176,
AileronTrim,
AntiTorqueControl,
AutopilotEnable,
ChaffRelease,
CollectiveControl,
DiveBrake,
ElectronicCountermeasures,
Elevator,
ElevatorTrim,
Rudder,
Throttle,
FlightCommunications,
FlareRelease,
LandingGear,
ToeBrake,
Trigger,
WeaponsArm,
WeaponsSelect,
WingFlaps,
Accelerator,
Brake,
Clutch,
Shifter,
Steering,
TurretDirection,
BarrelElevation,
DivePlane,
Ballast,
BicycleCrank,
HandleBars,
FrontBrake,
RearBrake,
ReservedD1_FFFF(u16),
}
impl<T> From<T> for SimulationControlsUsage
where
T: TryInto<u16>,
{
fn from(value: T) -> Self {
let value = value.try_into().unwrap_or(0);
match value {
0u16 => Self::Undefined,
1 => Self::FlightSimulationDevice,
2 => Self::AutomobileSimulationDevice,
3 => Self::TankSimulationDevice,
4 => Self::SpaceshipSimulationDevice,
5 => Self::SubmarineSimulationDevice,
6 => Self::SailingSimulationDevice,
7 => Self::MotorcycleSimulationDevice,
8 => Self::SportsSimulationDevice,
9 => Self::AirplaneSimulationDevice,
10 => Self::HelicopterSimulationDevice,
11 => Self::MagicCarpetSimulationDevice,
12 => Self::BicycleSimulationDevice,
13..32 => Self::Reserved0D_1F(value),
32 => Self::FlightControlStick,
33 => Self::FlightStick,
34 => Self::CyclicControl,
35 => Self::CyclicTrim,
36 => Self::FlightYoke,
37 => Self::TrackControl,
38..176 => Self::Reserved26_AF(value),
176 => Self::Aileron,
177 => Self::AileronTrim,
178 => Self::AntiTorqueControl,
179 => Self::AutopilotEnable,
180 => Self::ChaffRelease,
181 => Self::CollectiveControl,
182 => Self::DiveBrake,
183 => Self::ElectronicCountermeasures,
184 => Self::Elevator,
185 => Self::ElevatorTrim,
186 => Self::Rudder,
187 => Self::Throttle,
188 => Self::FlightCommunications,
189 => Self::FlareRelease,
190 => Self::LandingGear,
191 => Self::ToeBrake,
192 => Self::Trigger,
193 => Self::WeaponsArm,
194 => Self::WeaponsSelect,
195 => Self::WingFlaps,
196 => Self::Accelerator,
197 => Self::Brake,
198 => Self::Clutch,
199 => Self::Shifter,
200 => Self::Steering,
201 => Self::TurretDirection,
202 => Self::BarrelElevation,
203 => Self::DivePlane,
204 => Self::Ballast,
205 => Self::BicycleCrank,
206 => Self::HandleBars,
207 => Self::FrontBrake,
208 => Self::RearBrake,
209..=65535 => Self::ReservedD1_FFFF(value),
}
}
}