using System;
using System.Runtime.InteropServices;
using Microsoft.Win32.SafeHandles;
namespace SimConnect
{
///
/// Corresponds to SIMCONNECT_DATAType.
///
public enum SimConnectDataType
{
///
/// invalid data Type
///
Invalid = 0,
///
/// 32-bit integer number
///
Int32,
///
/// 64-bit integer number
///
Int64,
///
/// 32-bit floating-point number (Single)
///
Float32,
///
/// 64-bit floating-point number (Double)
///
Float64,
///
/// 8-byte String
///
String8,
///
/// 32-byte String
///
String32,
///
/// 64-byte String
///
String64,
///
/// 128-byte String
///
String128,
///
/// 256-byte String
///
String256,
///
/// 260-byte String
///
String260,
///
/// variable-length String
///
StringV,
///
/// see SIMCONNECT_DATA_INITPOSITION
///
InitPosition,
///
/// see SIMCONNECT_DATA_MARKERSTATE
///
MarkerState,
///
/// see SIMCONNECT_DATA_WAYPOINT
///
Waypoint,
///
/// see SIMCONNECT_DATA_LATLONALT
///
LatLonAlt,
///
/// see SIMCONNECT_DATA_XYZ
///
XYZ
}
// see SimConnect documentation
#pragma warning disable 1591
public enum SimConnectPeriod
{
Never = 0,
Once,
VisualFrame,
SimFrame,
Second
};
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct SimConnectRecv
{
public uint dwSize;
public uint dwVersion;
public uint dwID;
}
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct SimConnectRecvException
{
public SimConnectRecv Recv;
public uint dwException;
public uint dwSendID;
public uint dwIndex;
}
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct SimConnectRecvSimobjectData
{
public SimConnectRecv Recv;
public uint dwRequestID;
public uint dwObjectID;
public uint dwDefineID;
public uint dwFlags; // SIMCONNECT_DATA_REQUEST_FLAG
public uint dwentrynumber;
// if multiple objects returned, this is number out of .
public uint dwoutof; // note: starts with 1, not 0.
public uint dwDefineCount; // data count (number of datums, *not* byte count)
public uint dwData; // data begins here, dwDefineCount data items
}
///
/// Provides a low-level interface to a compatible SimConnect.dll.
///
public interface ISimConnectLibrary : IDisposable
{
uint SimConnect_Open(out IntPtr phSimConnect, string szName, IntPtr hwnd, uint userEventWin32, IntPtr hEventHandle, uint configIndex);
uint SimConnect_Close(IntPtr hSimConnect);
uint SimConnect_AddToDataDefinition(IntPtr hSimConnect, uint defineID, string datumName, string unitsName, SimConnectDataType datumType = SimConnectDataType.Float64, float epsilon = 0, uint datumID = uint.MaxValue);
uint SimConnect_ClearDataDefinition(IntPtr hSimConnect, uint defineID);
uint SimConnect_RequestDataOnSimObject(IntPtr hSimConnect, uint requestID, uint defineID, uint objectID, SimConnectPeriod period, uint flags, uint origin = 0, uint interval = 0, uint limit = 0);
uint SimConnect_GetNextDispatch(IntPtr hSimConnect, out IntPtr ppData, out uint pcbData);
}
public enum SimConnectRecvID
{
Null = 0,
Exception,
Open,
Quit,
Event,
EventObjectAddRemove,
EventFilename,
EventFrame,
SimobjectData,
SimobjectDataByType,
WeatherObservation,
CloudState,
AssignedObjectID,
ReservedKey,
CustomAction,
SystemState,
ClientData
};
#pragma warning restore 1591
}