1
0
Fork 0
mirror of https://github.com/hawkeye-stan/msfs-popout-panel-manager.git synced 2024-11-24 06:40:09 +00:00
msfs-popout-panel-manager/SimconnectAgent/SimDataDefinitions.cs

130 lines
11 KiB
C#
Raw Normal View History

2023-07-12 22:41:31 +00:00
using System.Collections.Generic;
namespace MSFSPopoutPanelManager.SimConnectAgent
{
public class SimDataDefinitions
{
public static List<SimConnectDataDefinition> GetRequiredDefinitions()
{
2024-02-28 02:44:21 +00:00
var definitions = new List<SimConnectDataDefinition>
{
new() { DefinitionId = DataDefinition.REQUIRED_DEFINITION, RequestId = DataRequest.REQUIRED_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.ElectricalMasterBattery, VariableName = "ELECTRICAL MASTER BATTERY", SimConnectUnit = "Bool", DataType = DataType.Float64 },
new() { DefinitionId = DataDefinition.REQUIRED_DEFINITION, RequestId = DataRequest.REQUIRED_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.AvionicsMasterSwitch, VariableName = "AVIONICS MASTER SWITCH", SimConnectUnit = "Bool", DataType = DataType.Float64 },
new() { DefinitionId = DataDefinition.REQUIRED_DEFINITION, RequestId = DataRequest.REQUIRED_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.TrackIREnable, VariableName = "TRACK IR ENABLE", SimConnectUnit = "Bool", DataType = DataType.Float64 },
new() { DefinitionId = DataDefinition.REQUIRED_DEFINITION, RequestId = DataRequest.REQUIRED_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.PlaneInParkingSpot, VariableName = "ATC ON PARKING SPOT", SimConnectUnit = "Bool", DataType = DataType.Float64 },
new() { DefinitionId = DataDefinition.REQUIRED_DEFINITION, RequestId = DataRequest.REQUIRED_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.CameraState, VariableName = "CAMERA STATE", SimConnectUnit = "Number", DataType = DataType.Float64 },
new() { DefinitionId = DataDefinition.REQUIRED_DEFINITION, RequestId = DataRequest.REQUIRED_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.CockpitCameraZoom, VariableName = "COCKPIT CAMERA ZOOM", SimConnectUnit = "Percentage", DataType = DataType.Float64 },
new() { DefinitionId = DataDefinition.REQUIRED_DEFINITION, RequestId = DataRequest.REQUIRED_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.PlaneAltAboveGround, VariableName = "PLANE ALT ABOVE GROUND", SimConnectUnit = "Feet", DataType = DataType.Float64 },
new() { DefinitionId = DataDefinition.REQUIRED_DEFINITION, RequestId = DataRequest.REQUIRED_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.CameraViewTypeAndIndex0, VariableName = "CAMERA VIEW TYPE AND INDEX:0", SimConnectUnit = "Enum", DataType = DataType.Float64 },
new() { DefinitionId = DataDefinition.REQUIRED_DEFINITION, RequestId = DataRequest.REQUIRED_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.CameraViewTypeAndIndex1, VariableName = "CAMERA VIEW TYPE AND INDEX:1", SimConnectUnit = "Enum", DataType = DataType.Float64 },
new() { DefinitionId = DataDefinition.REQUIRED_DEFINITION, RequestId = DataRequest.REQUIRED_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.CameraViewTypeAndIndex1Max, VariableName = "CAMERA VIEW TYPE AND INDEX MAX:1", SimConnectUnit = "Number", DataType = DataType.Float64 },
new() { DefinitionId = DataDefinition.REQUIRED_DEFINITION, RequestId = DataRequest.REQUIRED_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.CameraViewTypeAndIndex2Max, VariableName = "CAMERA VIEW TYPE AND INDEX MAX:2", SimConnectUnit = "Number", DataType = DataType.Float64 },
};
2023-07-12 22:41:31 +00:00
return definitions;
}
public static List<SimConnectDataDefinition> GetHudBarDefinitions(SimDataDefinitionType definitionType)
{
List<SimConnectDataDefinition> definitions;
switch (definitionType)
{
case SimDataDefinitionType.GenericHudBar:
definitions = GetSharedHudBarDefinitions();
definitions.AddRange(GetGenericAircraftHudBarDefinitions());
return definitions;
2024-02-28 02:44:21 +00:00
case SimDataDefinitionType.Pmdg737HudBar:
2023-07-12 22:41:31 +00:00
definitions = GetSharedHudBarDefinitions();
2024-02-28 02:44:21 +00:00
definitions.AddRange(GetPmdg737HudBarDefinitions());
2023-07-12 22:41:31 +00:00
return definitions;
case SimDataDefinitionType.NoHudBar:
default:
return null;
}
}
private static List<SimConnectDataDefinition> GetSharedHudBarDefinitions()
{
2024-02-28 02:44:21 +00:00
var definitions = new List<SimConnectDataDefinition>
{
new() { DefinitionId = DataDefinition.HUDBAR_DEFINITION, RequestId = DataRequest.HUDBAR_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.SimRate, VariableName = "SIMULATION RATE", SimConnectUnit = "Number", DataType = DataType.Float64 },
new() { DefinitionId = DataDefinition.HUDBAR_DEFINITION, RequestId = DataRequest.HUDBAR_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.ParkingBrake, VariableName = "BRAKE PARKING INDICATOR", SimConnectUnit = "Bool", DataType = DataType.Float64 },
new() { DefinitionId = DataDefinition.HUDBAR_DEFINITION, RequestId = DataRequest.HUDBAR_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.GearLeft, VariableName = "GEAR LEFT POSITION", SimConnectUnit = "Percent", DataType = DataType.Float64 },
new() { DefinitionId = DataDefinition.HUDBAR_DEFINITION, RequestId = DataRequest.HUDBAR_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.GearCenter, VariableName = "GEAR CENTER POSITION", SimConnectUnit = "Percent", DataType = DataType.Float64 },
new() { DefinitionId = DataDefinition.HUDBAR_DEFINITION, RequestId = DataRequest.HUDBAR_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.GearRight, VariableName = "GEAR RIGHT POSITION", SimConnectUnit = "Percent", DataType = DataType.Float64 }
};
2023-07-12 22:41:31 +00:00
return definitions;
}
private static List<SimConnectDataDefinition> GetGenericAircraftHudBarDefinitions()
{
2024-02-28 02:44:21 +00:00
var definitions = new List<SimConnectDataDefinition>
{
new() { DefinitionId = DataDefinition.HUDBAR_DEFINITION, RequestId = DataRequest.HUDBAR_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.ElevatorTrim, VariableName = "ELEVATOR TRIM PCT", SimConnectUnit = "percent", DataType = DataType.Float64 },
new() { DefinitionId = DataDefinition.HUDBAR_DEFINITION, RequestId = DataRequest.HUDBAR_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.AileronTrim, VariableName = "AILERON TRIM", SimConnectUnit = "radians", DataType = DataType.Float64 },
new() { DefinitionId = DataDefinition.HUDBAR_DEFINITION, RequestId = DataRequest.HUDBAR_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.RudderTrim, VariableName = "RUDDER TRIM", SimConnectUnit = "radians", DataType = DataType.Float64 },
new() { DefinitionId = DataDefinition.HUDBAR_DEFINITION, RequestId = DataRequest.HUDBAR_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.Flap, VariableName = "TRAILING EDGE FLAPS LEFT ANGLE", SimConnectUnit = "degrees", DataType = DataType.Float64 }
};
2023-07-12 22:41:31 +00:00
return definitions;
}
2024-02-28 02:44:21 +00:00
private static List<SimConnectDataDefinition> GetPmdg737HudBarDefinitions()
2023-07-12 22:41:31 +00:00
{
2024-02-28 02:44:21 +00:00
var definitions = new List<SimConnectDataDefinition>
{
new() { DefinitionId = DataDefinition.HUDBAR_DEFINITION, RequestId = DataRequest.HUDBAR_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.ElevatorTrim, VariableName = "L:switch_690_73X", SimConnectUnit = "number", DataType = DataType.Float64 },
new() { DefinitionId = DataDefinition.HUDBAR_DEFINITION, RequestId = DataRequest.HUDBAR_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.AileronTrim, VariableName = "AILERON POSITION", SimConnectUnit = "Position 16k", DataType = DataType.Float64 },
new() { DefinitionId = DataDefinition.HUDBAR_DEFINITION, RequestId = DataRequest.HUDBAR_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.RudderTrim, VariableName = "RUDDER DEFLECTION PCT", SimConnectUnit = "Percent Over 100", DataType = DataType.Float64 },
new() { DefinitionId = DataDefinition.HUDBAR_DEFINITION, RequestId = DataRequest.HUDBAR_REQUEST, DataDefinitionType = DataDefinitionType.SimConnect, PropName = PropName.Flap, VariableName = "FLAPS HANDLE INDEX", SimConnectUnit = "Number", DataType = DataType.Float64 }
};
2023-07-12 22:41:31 +00:00
return definitions;
}
public static class PropName
{
public static string ElectricalMasterBattery = "ElectricalMasterBattery";
public static string AvionicsMasterSwitch = "AvionicsMasterSwitch";
public static string TrackIREnable = "TrackIREnable";
public static string PlaneInParkingSpot = "PlaneInParkingSpot";
public static string CameraState = "CameraState";
2023-07-30 21:30:47 +00:00
public static string CockpitCameraZoom = "CockpitCameraZoom";
2024-02-28 02:44:21 +00:00
public static string CameraViewTypeAndIndex0 = "CameraViewTypeAndIndex0";
2023-08-14 04:35:14 +00:00
public static string CameraViewTypeAndIndex1 = "CameraViewTypeAndIndex1";
2024-02-28 02:44:21 +00:00
public static string CameraViewTypeAndIndex1Max = "CameraViewTypeAndIndex1Max";
public static string CameraViewTypeAndIndex2Max = "CameraViewTypeAndIndex2Max";
// Dynamic LOD
public static string PlaneAltAboveGround = "PlaneAltAboveGround";
2023-07-12 22:41:31 +00:00
// Hud Bar data
public static string ElevatorTrim = "ElevatorTrim";
public static string AileronTrim = "AileronTrim";
public static string RudderTrim = "RudderTrim";
public static string ParkingBrake = "ParkingBrake";
public static string Flap = "Flap";
public static string GearLeft = "GearLeft";
public static string GearCenter = "GearCenter";
public static string GearRight = "GearRight";
public static string SimRate = "SimRate";
}
2024-02-28 02:44:21 +00:00
public enum WritableVariableName
2023-07-12 22:41:31 +00:00
{
2023-07-30 21:30:47 +00:00
TrackIREnable,
2023-08-16 03:41:14 +00:00
CockpitCameraZoom,
2024-02-29 00:54:25 +00:00
CameraState,
2024-02-28 02:44:21 +00:00
CameraRequestAction,
CameraViewTypeAndIndex0,
CameraViewTypeAndIndex1
2023-07-12 22:41:31 +00:00
}
}
public enum SimDataDefinitionType
{
NoHudBar,
GenericHudBar,
2024-02-28 02:44:21 +00:00
Pmdg737HudBar
2023-07-12 22:41:31 +00:00
}
}