Documentation
¶
Index ¶
- Constants
- func BytesToString(data []byte) string
- func CastAs[T any](m *Message) T
- func CastDataAs[T any](dwData *types.DWORD) *T
- func InputEventValueAsFloat64(recv *types.SIMCONNECT_RECV_GET_INPUT_EVENT) (float64, bool)
- func InputEventValueAsString(recv *types.SIMCONNECT_RECV_GET_INPUT_EVENT) (string, bool)
- func PackWaypoints(wps []types.SIMCONNECT_DATA_WAYPOINT) []byte
- func SubscribeInputEventHash(recv *types.SIMCONNECT_RECV_SUBSCRIBE_INPUT_EVENT) uint64
- func SubscribeInputEventValueAsFloat64(recv *types.SIMCONNECT_RECV_SUBSCRIBE_INPUT_EVENT) (float64, bool)
- func SubscribeInputEventValueAsString(recv *types.SIMCONNECT_RECV_SUBSCRIBE_INPUT_EVENT) (string, bool)
- func SystemStateFloat64(recv *types.SIMCONNECT_RECV_SYSTEM_STATE) float64
- type Client
- type Config
- type Engine
- func (e *Engine) AICreateEnrouteATCAircraft(szContainerTitle string, szTailNumber string, iFlightNumber uint32, ...) error
- func (e *Engine) AICreateEnrouteATCAircraftEX1(szContainerTitle string, szLivery string, szTailNumber string, ...) error
- func (e *Engine) AICreateNonATCAircraft(szContainerTitle string, szTailNumber string, ...) error
- func (e *Engine) AICreateNonATCAircraftEX1(szContainerTitle string, szLivery string, szTailNumber string, ...) error
- func (e *Engine) AICreateParkedATCAircraft(szContainerTitle string, szTailNumber string, szAirportID string, ...) error
- func (e *Engine) AICreateParkedATCAircraftEX1(szContainerTitle string, szLivery string, szTailNumber string, ...) error
- func (e *Engine) AICreateSimulatedObject(szContainerTitle string, initPos types.SIMCONNECT_DATA_INITPOSITION, ...) error
- func (e *Engine) AIReleaseControl(objectID uint32, requestID uint32) error
- func (e *Engine) AIRemoveObject(objectID uint32, requestID uint32) error
- func (e *Engine) AISetAircraftFlightPlan(objectID uint32, szFlightPlanPath string, requestID uint32) error
- func (e *Engine) AddClientEventToNotificationGroup(groupID uint32, eventID uint32, mask bool) error
- func (e *Engine) AddFacilityDataDefinitionFilter(definitionID uint32, filterPath string, filterData unsafe.Pointer, ...) error
- func (e *Engine) AddToClientDataDefinition(defineID uint32, dwOffset uint32, dwSizeOrType uint32, epsilon float32, ...) error
- func (e *Engine) AddToDataDefinition(definitionID uint32, datumName string, unitsName string, ...) error
- func (e *Engine) AddToFacilityDefinition(definitionID uint32, fieldName string) error
- func (e *Engine) ClearAllFacilityDataDefinitionFilters(definitionID uint32) error
- func (e *Engine) ClearClientDataDefinition(defineID uint32) error
- func (e *Engine) ClearDataDefinition(definitionID uint32) error
- func (e *Engine) ClearNotificationGroup(groupID uint32) error
- func (e *Engine) Connect() error
- func (e *Engine) CreateClientData(clientDataID uint32, dwSize uint32, ...) error
- func (e *Engine) Disconnect() error
- func (e *Engine) EnumerateInputEvents(requestID uint32) error
- func (e *Engine) EnumerateSimObjectsAndLiveries(requestID uint32, objectType types.SIMCONNECT_SIMOBJECT_TYPE) error
- func (e *Engine) FlightLoad(flightFile string) error
- func (e *Engine) FlightPlanLoad(flightPlanFile string) error
- func (e *Engine) FlightSave(flightFile string, title string, description string) error
- func (e *Engine) GetInputEvent(requestID uint32, hash uint64) error
- func (e *Engine) MapClientDataNameToID(clientDataName string, clientDataID uint32) error
- func (e *Engine) MapClientEventToSimEvent(eventID uint32, eventName string) error
- func (e *Engine) RegisterDataset(definitionID uint32, dataset *datasets.DataSet) error
- func (e *Engine) RegisterFacilityDataset(definitionID uint32, dataset *datasets.FacilityDataSet) error
- func (e *Engine) RemoveClientEvent(groupID uint32, eventID uint32) error
- func (e *Engine) RequestAllFacilities(listType types.SIMCONNECT_FACILITY_LIST_TYPE, requestID uint32) error
- func (e *Engine) RequestClientData(clientDataID uint32, requestID uint32, defineID uint32, ...) error
- func (e *Engine) RequestDataOnSimObject(requestID uint32, definitionID uint32, objectID uint32, ...) error
- func (e *Engine) RequestDataOnSimObjectType(requestID uint32, definitionID uint32, dwRadiusMeters uint32, ...) error
- func (e *Engine) RequestFacilitiesList(definitionID uint32, listType types.SIMCONNECT_FACILITY_LIST_TYPE) error
- func (e *Engine) RequestFacilitiesListEX1(definitionID uint32, listType types.SIMCONNECT_FACILITY_LIST_TYPE) error
- func (e *Engine) RequestFacilityData(definitionID uint32, requestID uint32, icao string, region string) error
- func (e *Engine) RequestFacilityDataEX1(definitionID uint32, requestID uint32, icao string, region string, ...) error
- func (e *Engine) RequestJetwayData(airportICAO string, arrayCount uint32, indexes *int32) error
- func (e *Engine) RequestNotificationGroup(groupID uint32, dwReserved uint32, flags uint32) error
- func (e *Engine) RequestSystemState(requestID uint32, state types.SIMCONNECT_SYSTEM_STATE) error
- func (e *Engine) SetClientData(clientDataID uint32, defineID uint32, flags uint32, dwReserved uint32, ...) error
- func (e *Engine) SetDataOnSimObject(definitionID uint32, objectID uint32, flags types.SIMCONNECT_DATA_SET_FLAG, ...) error
- func (e *Engine) SetInputEventDouble(hash uint64, value float64) error
- func (e *Engine) SetInputEventString(hash uint64, value string) error
- func (e *Engine) SetNotificationGroupPriority(groupID uint32, priority uint32) error
- func (e *Engine) SetSystemEventState(eventID uint32, state types.SIMCONNECT_STATE) error
- func (e *Engine) Stream() <-chan Message
- func (e *Engine) SubscribeInputEvent(hash uint64) error
- func (e *Engine) SubscribeToFacilities(listType types.SIMCONNECT_FACILITY_LIST_TYPE, requestID uint32) error
- func (e *Engine) SubscribeToFacilitiesEX1(listType types.SIMCONNECT_FACILITY_LIST_TYPE, newElemInRangeRequestID uint32, ...) error
- func (e *Engine) SubscribeToFlowEvent() error
- func (e *Engine) SubscribeToSystemEvent(eventID uint32, eventName string) error
- func (e *Engine) TransmitClientEvent(objectID uint32, eventID uint32, data uint32, groupID uint32, ...) error
- func (e *Engine) TransmitClientEventEx1(objectID uint32, eventID uint32, groupID uint32, ...) error
- func (e *Engine) UnsubscribeFromFlowEvent() error
- func (e *Engine) UnsubscribeFromSystemEvent(eventID uint32) error
- func (e *Engine) UnsubscribeInputEvent(hash uint64) error
- func (e *Engine) UnsubscribeToFacilitiesEX1(listType types.SIMCONNECT_FACILITY_LIST_TYPE, unsubscribeNewInRange bool, ...) error
- type HeartbeatFrequency
- type Message
- func (m *Message) AsAirportList() *types.SIMCONNECT_RECV_AIRPORT_LIST
- func (m *Message) AsAssignedObjectID() *types.SIMCONNECT_RECV_ASSIGNED_OBJECT_ID
- func (m *Message) AsClientData() *types.SIMCONNECT_RECV_CLIENT_DATA
- func (m *Message) AsEnumerateInputEvents() *types.SIMCONNECT_RECV_ENUMERATE_INPUT_EVENTS
- func (m *Message) AsEvent() *types.SIMCONNECT_RECV_EVENT
- func (m *Message) AsEventFilename() *types.SIMCONNECT_RECV_EVENT_FILENAME
- func (m *Message) AsEventFrame() *types.SIMCONNECT_RECV_EVENT_FRAME
- func (m *Message) AsEventObjectAddRemove() *types.SIMCONNECT_RECV_EVENT_OBJECT_ADDREMOVE
- func (m *Message) AsException() *types.SIMCONNECT_RECV_EXCEPTION
- func (m *Message) AsFacilityData() *types.SIMCONNECT_RECV_FACILITY_DATA
- func (m *Message) AsFacilityDataEnd() *types.SIMCONNECT_RECV_FACILITY_DATA_END
- func (m *Message) AsFacilityList() *types.SIMCONNECT_RECV_FACILITIES_LIST
- func (m *Message) AsFlowEvent() *types.SIMCONNECT_RECV_FLOW_EVENT
- func (m *Message) AsGetInputEvent() *types.SIMCONNECT_RECV_GET_INPUT_EVENT
- func (m *Message) AsNDBList() *types.SIMCONNECT_RECV_NDB_LIST
- func (m *Message) AsOpen() *types.SIMCONNECT_RECV_OPEN
- func (m *Message) AsSimObjectAndLiveryEnumeration() *types.SIMCONNECT_RECV_ENUMERATE_SIMOBJECT_AND_LIVERY_LIST
- func (m *Message) AsSimObjectData() *types.SIMCONNECT_RECV_SIMOBJECT_DATA
- func (m *Message) AsSimObjectDataBType() *types.SIMCONNECT_RECV_SIMOBJECT_DATA_BTYPE
- func (m *Message) AsSubscribeInputEvent() *types.SIMCONNECT_RECV_SUBSCRIBE_INPUT_EVENT
- func (m *Message) AsVORList() *types.SIMCONNECT_RECV_VOR_LIST
- func (m *Message) AsWaypointList() *types.SIMCONNECT_RECV_WAYPOINT_LIST
- func (m *Message) Release()
- type Option
- func WithAutoDetect() Option
- func WithBufferSize(size int) Option
- func WithContext(ctx context.Context) Option
- func WithDLLPath(path string) Option
- func WithHeartbeat(frequency HeartbeatFrequency) Option
- func WithLogLevel(level slog.Level) Option
- func WithLogLevelFromString(level string) Option
- func WithLogger(logger *slog.Logger) Option
Constants ¶
const ( DEFAULT_BUFFER_SIZE = 256 DEFAULT_DLL_PATH = "C:/MSFS 2024 SDK/SimConnect SDK/lib/SimConnect.dll" )
const (
HEARTBEAT_EVENT_ID types.DWORD = 999999999 // SimConnect_SystemState_6Hz ID
)
const WaypointWireSize = waypointWireSize
WaypointWireSize is the packed wire size per SIMCONNECT_DATA_WAYPOINT element.
Variables ¶
This section is empty.
Functions ¶
func BytesToString ¶
func CastDataAs ¶
CastData casts the DwData field from a SimObject data response to the specified struct type. The type T must match the data definition structure registered with SimConnect.
func InputEventValueAsFloat64 ¶ added in v0.4.2
func InputEventValueAsFloat64(recv *types.SIMCONNECT_RECV_GET_INPUT_EVENT) (float64, bool)
InputEventValueAsFloat64 extracts the float64 value from a GET_INPUT_EVENT receive struct. Returns (0, false) if Type is not SIMCONNECT_INPUT_EVENT_TYPE_DOUBLE.
func InputEventValueAsString ¶ added in v0.4.2
func InputEventValueAsString(recv *types.SIMCONNECT_RECV_GET_INPUT_EVENT) (string, bool)
InputEventValueAsString extracts the string value from a GET_INPUT_EVENT receive struct. Returns ("", false) if Type is not SIMCONNECT_INPUT_EVENT_TYPE_STRING.
func PackWaypoints ¶ added in v0.3.7
func PackWaypoints(wps []types.SIMCONNECT_DATA_WAYPOINT) []byte
PackWaypoints serialises a slice of SIMCONNECT_DATA_WAYPOINT into the 44-byte-per-element packed wire format that SimConnect expects.
The Go struct is 48 bytes due to 4 bytes of implicit padding inserted after the uint32 Flags field to align the following float64. SimConnect's C header uses #pragma pack(1) so that padding does not exist on the wire.
Use the returned slice with SetDataOnSimObject:
packed := engine.PackWaypoints(wps)
client.SetDataOnSimObject(defID, objID, flag,
uint32(len(wps)), engine.WaypointWireSize, unsafe.Pointer(&packed[0]))
func SubscribeInputEventHash ¶ added in v0.4.2
func SubscribeInputEventHash(recv *types.SIMCONNECT_RECV_SUBSCRIBE_INPUT_EVENT) uint64
SubscribeInputEventHash extracts the event hash from a SUBSCRIBE_INPUT_EVENT receive struct. HashBytes is stored as [8]byte at wire offset 12 to avoid Go alignment padding.
func SubscribeInputEventValueAsFloat64 ¶ added in v0.4.2
func SubscribeInputEventValueAsFloat64(recv *types.SIMCONNECT_RECV_SUBSCRIBE_INPUT_EVENT) (float64, bool)
SubscribeInputEventValueAsFloat64 extracts the float64 value from a SUBSCRIBE_INPUT_EVENT receive struct. Returns (0, false) if EType is not SIMCONNECT_INPUT_EVENT_TYPE_DOUBLE.
func SubscribeInputEventValueAsString ¶ added in v0.4.2
func SubscribeInputEventValueAsString(recv *types.SIMCONNECT_RECV_SUBSCRIBE_INPUT_EVENT) (string, bool)
SubscribeInputEventValueAsString extracts the string value from a SUBSCRIBE_INPUT_EVENT receive struct. Returns ("", false) if EType is not SIMCONNECT_INPUT_EVENT_TYPE_STRING.
func SystemStateFloat64 ¶ added in v0.4.2
func SystemStateFloat64(recv *types.SIMCONNECT_RECV_SYSTEM_STATE) float64
SystemStateFloat64 extracts the float64 value from a SYSTEM_STATE receive struct. FFloatBytes is stored as [8]byte at wire offset 20 to avoid Go alignment padding (float64 after 12+4+4 bytes would be padded to offset 24 by Go).
Types ¶
type Client ¶
type Client interface {
Connect() error
Disconnect() error
Stream() <-chan Message
RegisterDataset(definitionID uint32, dataset *datasets.DataSet) error
RegisterFacilityDataset(definitionID uint32, dataset *datasets.FacilityDataSet) error
RequestSystemState(requestID uint32, state types.SIMCONNECT_SYSTEM_STATE) error
SubscribeToSystemEvent(eventID uint32, eventName string) error
UnsubscribeFromSystemEvent(eventID uint32) error
// SubscribeToFlowEvent subscribes to all simulator flow events (MSFS 2024 only).
SubscribeToFlowEvent() error
// UnsubscribeFromFlowEvent cancels the active flow event subscription (MSFS 2024 only).
UnsubscribeFromFlowEvent() error
// Input Event API (MSFS 2024 only)
EnumerateInputEvents(requestID uint32) error
GetInputEvent(requestID uint32, hash uint64) error
SetInputEventDouble(hash uint64, value float64) error
SetInputEventString(hash uint64, value string) error
SubscribeInputEvent(hash uint64) error
UnsubscribeInputEvent(hash uint64) error
AddToDataDefinition(definitionID uint32, datumName string, unitsName string, datumType types.SIMCONNECT_DATATYPE, epsilon float32, datumID uint32) error
RequestDataOnSimObject(requestID uint32, definitionID uint32, objectID uint32, period types.SIMCONNECT_PERIOD, flags types.SIMCONNECT_DATA_REQUEST_FLAG, origin uint32, interval uint32, limit uint32) error
RequestDataOnSimObjectType(requestID uint32, definitionID uint32, dwRadiusMeters uint32, objectType types.SIMCONNECT_SIMOBJECT_TYPE) error
ClearDataDefinition(definitionID uint32) error
SetDataOnSimObject(definitionID uint32, objectID uint32, flags types.SIMCONNECT_DATA_SET_FLAG, arrayCount uint32, cbUnitSize uint32, data unsafe.Pointer) error
AICreateParkedATCAircraft(szContainerTitle string, szTailNumber string, szAirportID string, RequestID uint32) error
AISetAircraftFlightPlan(objectID uint32, szFlightPlanPath string, requestID uint32) error
AICreateEnrouteATCAircraft(szContainerTitle string, szTailNumber string, iFlightNumber uint32, szFlightPlanPath string, dFlightPlanPosition float64, bTouchAndGo bool, RequestID uint32) error
AICreateNonATCAircraft(szContainerTitle string, szTailNumber string, initPos types.SIMCONNECT_DATA_INITPOSITION, RequestID uint32) error
AICreateSimulatedObject(szContainerTitle string, initPos types.SIMCONNECT_DATA_INITPOSITION, RequestID uint32) error
AIReleaseControl(objectID uint32, requestID uint32) error
AIRemoveObject(objectID uint32, requestID uint32) error
EnumerateSimObjectsAndLiveries(requestID uint32, objectType types.SIMCONNECT_SIMOBJECT_TYPE) error
AICreateEnrouteATCAircraftEX1(szContainerTitle string, szLivery string, szTailNumber string, iFlightNumber uint32, szFlightPlanPath string, dFlightPlanPosition float64, bTouchAndGo bool, RequestID uint32) error
AICreateNonATCAircraftEX1(szContainerTitle string, szLivery string, szTailNumber string, initPos types.SIMCONNECT_DATA_INITPOSITION, RequestID uint32) error
AICreateParkedATCAircraftEX1(szContainerTitle string, szLivery string, szTailNumber string, szAirportID string, RequestID uint32) error
FlightLoad(flightFile string) error
FlightPlanLoad(flightPlanFile string) error
FlightSave(flightFile string, title string, description string) error
AddToFacilityDefinition(definitionID uint32, fieldName string) error
AddFacilityDataDefinitionFilter(definitionID uint32, filterPath string, filterData unsafe.Pointer, filterDataSize uint32) error
ClearAllFacilityDataDefinitionFilters(definitionID uint32) error
RequestFacilitiesList(definitionID uint32, listType types.SIMCONNECT_FACILITY_LIST_TYPE) error
RequestFacilitiesListEX1(definitionID uint32, listType types.SIMCONNECT_FACILITY_LIST_TYPE) error
RequestFacilityData(definitionID uint32, requestID uint32, icao string, region string) error
RequestFacilityDataEX1(definitionID uint32, requestID uint32, icao string, region string, facilityType byte) error
RequestJetwayData(airportICAO string, arrayCount uint32, indexes *int32) error
SubscribeToFacilities(listType types.SIMCONNECT_FACILITY_LIST_TYPE, requestID uint32) error
SubscribeToFacilitiesEX1(listType types.SIMCONNECT_FACILITY_LIST_TYPE, newElemInRangeRequestID uint32, oldElemOutRangeRequestID uint32) error
UnsubscribeToFacilitiesEX1(listType types.SIMCONNECT_FACILITY_LIST_TYPE, unsubscribeNewInRange bool, unsubscribeOldOutRange bool) error
RequestAllFacilities(listType types.SIMCONNECT_FACILITY_LIST_TYPE, requestID uint32) error
MapClientEventToSimEvent(eventID uint32, eventName string) error
RemoveClientEvent(groupID uint32, eventID uint32) error
TransmitClientEvent(objectID uint32, eventID uint32, data uint32, groupID uint32, flags types.SIMCONNECT_EVENT_FLAG) error
TransmitClientEventEx1(objectID uint32, eventID uint32, groupID uint32, flags types.SIMCONNECT_EVENT_FLAG, data [5]uint32) error
MapClientDataNameToID(clientDataName string, clientDataID uint32) error
// Client Data Area Methods
CreateClientData(clientDataID uint32, dwSize uint32, flags types.SIMCONNECT_CREATE_CLIENT_DATA_FLAG) error
AddToClientDataDefinition(defineID uint32, dwOffset uint32, dwSizeOrType uint32, epsilon float32, datumID uint32) error
ClearClientDataDefinition(defineID uint32) error
RequestClientData(clientDataID uint32, requestID uint32, defineID uint32, period types.SIMCONNECT_CLIENT_DATA_PERIOD, flags types.SIMCONNECT_CLIENT_DATA_REQUEST_FLAG, origin uint32, interval uint32, limit uint32) error
SetClientData(clientDataID uint32, defineID uint32, flags uint32, dwReserved uint32, cbUnitSize uint32, data unsafe.Pointer) error
AddClientEventToNotificationGroup(groupID uint32, eventID uint32, mask bool) error
ClearNotificationGroup(groupID uint32) error
RequestNotificationGroup(groupID uint32, dwReserved uint32, flags uint32) error
SetNotificationGroupPriority(groupID uint32, priority uint32) error
}
type Config ¶
type Config struct {
simconnect.Config
Heartbeat HeartbeatFrequency
Logger *slog.Logger
// LogLevel controls the minimum level used when the package constructs
// a default logger. If `Logger` is provided via `WithLogger`, that
// logger takes precedence.
LogLevel slog.Level
}
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func (*Engine) AICreateEnrouteATCAircraft ¶
func (*Engine) AICreateEnrouteATCAircraftEX1 ¶
func (*Engine) AICreateNonATCAircraft ¶
func (*Engine) AICreateNonATCAircraftEX1 ¶
func (*Engine) AICreateParkedATCAircraft ¶
func (*Engine) AICreateParkedATCAircraftEX1 ¶
func (*Engine) AICreateSimulatedObject ¶
func (*Engine) AIReleaseControl ¶
func (*Engine) AIRemoveObject ¶
func (*Engine) AISetAircraftFlightPlan ¶
func (*Engine) AddClientEventToNotificationGroup ¶
func (*Engine) AddFacilityDataDefinitionFilter ¶
func (*Engine) AddToClientDataDefinition ¶ added in v0.5.0
func (e *Engine) AddToClientDataDefinition(defineID uint32, dwOffset uint32, dwSizeOrType uint32, epsilon float32, datumID uint32) error
AddToClientDataDefinition adds a data field to a client data definition. https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_AddToClientDataDefinition.htm
func (*Engine) AddToDataDefinition ¶
func (*Engine) AddToFacilityDefinition ¶
func (*Engine) ClearAllFacilityDataDefinitionFilters ¶
func (*Engine) ClearClientDataDefinition ¶ added in v0.6.0
ClearClientDataDefinition removes all data definitions for the given client data definition ID. https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_ClearClientDataDefinition.htm
func (*Engine) ClearDataDefinition ¶
func (*Engine) ClearNotificationGroup ¶
func (*Engine) CreateClientData ¶ added in v0.5.0
func (e *Engine) CreateClientData(clientDataID uint32, dwSize uint32, flags types.SIMCONNECT_CREATE_CLIENT_DATA_FLAG) error
CreateClientData registers a client data area with the given ID and size. dwSize must be between 1 and 8192 bytes; the SimConnect SDK returns an HRESULT error if exceeded. https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_CreateClientData.htm
func (*Engine) Disconnect ¶
func (*Engine) EnumerateInputEvents ¶ added in v0.4.2
func (*Engine) EnumerateSimObjectsAndLiveries ¶
func (e *Engine) EnumerateSimObjectsAndLiveries(requestID uint32, objectType types.SIMCONNECT_SIMOBJECT_TYPE) error
func (*Engine) FlightLoad ¶
func (*Engine) FlightPlanLoad ¶
func (*Engine) FlightSave ¶
func (*Engine) GetInputEvent ¶ added in v0.4.2
func (*Engine) MapClientDataNameToID ¶
func (*Engine) MapClientEventToSimEvent ¶
func (*Engine) RegisterDataset ¶
func (*Engine) RegisterFacilityDataset ¶ added in v0.2.0
func (e *Engine) RegisterFacilityDataset(definitionID uint32, dataset *datasets.FacilityDataSet) error
func (*Engine) RemoveClientEvent ¶
func (*Engine) RequestAllFacilities ¶
func (e *Engine) RequestAllFacilities(listType types.SIMCONNECT_FACILITY_LIST_TYPE, requestID uint32) error
func (*Engine) RequestClientData ¶ added in v0.5.0
func (e *Engine) RequestClientData(clientDataID uint32, requestID uint32, defineID uint32, period types.SIMCONNECT_CLIENT_DATA_PERIOD, flags types.SIMCONNECT_CLIENT_DATA_REQUEST_FLAG, origin uint32, interval uint32, limit uint32) error
RequestClientData subscribes to client data area updates for the given definition. https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_RequestClientData.htm
func (*Engine) RequestDataOnSimObject ¶
func (*Engine) RequestDataOnSimObjectType ¶
func (*Engine) RequestFacilitiesList ¶
func (e *Engine) RequestFacilitiesList(definitionID uint32, listType types.SIMCONNECT_FACILITY_LIST_TYPE) error
func (*Engine) RequestFacilitiesListEX1 ¶
func (e *Engine) RequestFacilitiesListEX1(definitionID uint32, listType types.SIMCONNECT_FACILITY_LIST_TYPE) error
func (*Engine) RequestFacilityData ¶
func (*Engine) RequestFacilityDataEX1 ¶
func (*Engine) RequestJetwayData ¶
func (*Engine) RequestNotificationGroup ¶
func (*Engine) RequestSystemState ¶
func (e *Engine) RequestSystemState(requestID uint32, state types.SIMCONNECT_SYSTEM_STATE) error
func (*Engine) SetClientData ¶ added in v0.5.0
func (e *Engine) SetClientData(clientDataID uint32, defineID uint32, flags uint32, dwReserved uint32, cbUnitSize uint32, data unsafe.Pointer) error
SetClientData writes data to a client data area. flags is a plain uint32 per ADR-B-01 — SimConnect.h does not define a typed enum for SetClientData flags. dwReserved must be 0. https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_SetClientData.htm
func (*Engine) SetDataOnSimObject ¶
func (*Engine) SetInputEventDouble ¶ added in v0.4.2
SetInputEventDouble sets a DOUBLE-typed input event value. The float64 is stack-allocated; its address is valid for the duration of the synchronous DLL call.
func (*Engine) SetInputEventString ¶ added in v0.4.2
SetInputEventString sets a STRING-typed input event value. value is copied into a 260-byte null-terminated buffer. Strings longer than 259 bytes are silently truncated to 259 bytes to preserve the null terminator at buf[259].
func (*Engine) SetNotificationGroupPriority ¶
func (*Engine) SetSystemEventState ¶
func (e *Engine) SetSystemEventState(eventID uint32, state types.SIMCONNECT_STATE) error
func (*Engine) SubscribeInputEvent ¶ added in v0.4.2
func (*Engine) SubscribeToFacilities ¶
func (e *Engine) SubscribeToFacilities(listType types.SIMCONNECT_FACILITY_LIST_TYPE, requestID uint32) error
func (*Engine) SubscribeToFacilitiesEX1 ¶
func (*Engine) SubscribeToFlowEvent ¶ added in v0.3.9
SubscribeToFlowEvent subscribes to all simulator flow events. Once subscribed, SIMCONNECT_RECV_FLOW_EVENT messages are delivered via Stream().
Note: MSFS 2024 only — returns an error on MSFS 2020.
func (*Engine) SubscribeToSystemEvent ¶
func (*Engine) TransmitClientEvent ¶
func (*Engine) TransmitClientEventEx1 ¶
func (*Engine) UnsubscribeFromFlowEvent ¶ added in v0.3.9
UnsubscribeFromFlowEvent cancels the active flow event subscription.
Note: MSFS 2024 only — returns an error on MSFS 2020.
func (*Engine) UnsubscribeFromSystemEvent ¶
func (*Engine) UnsubscribeInputEvent ¶ added in v0.4.2
func (*Engine) UnsubscribeToFacilitiesEX1 ¶
type HeartbeatFrequency ¶
type HeartbeatFrequency string
HeartbeatFrequency represents the valid heartbeat frequencies for SimConnect system events.
const ( HEARTBEAT_6HZ HeartbeatFrequency = "6Hz" HEARTBEAT_1SEC HeartbeatFrequency = "1sec" HEARTBEAT_4SEC HeartbeatFrequency = "4sec" HEARTBEAT_FRAME HeartbeatFrequency = "Frame" )
type Message ¶
type Message struct {
*types.SIMCONNECT_RECV
Size uint32
Err error
// contains filtered or unexported fields
}
func (*Message) AsAirportList ¶
func (m *Message) AsAirportList() *types.SIMCONNECT_RECV_AIRPORT_LIST
func (*Message) AsAssignedObjectID ¶ added in v0.3.7
func (m *Message) AsAssignedObjectID() *types.SIMCONNECT_RECV_ASSIGNED_OBJECT_ID
func (*Message) AsClientData ¶ added in v0.5.0
func (m *Message) AsClientData() *types.SIMCONNECT_RECV_CLIENT_DATA
AsClientData casts the message to SIMCONNECT_RECV_CLIENT_DATA. Returns nil if the message is not a client data notification.
func (*Message) AsEnumerateInputEvents ¶ added in v0.4.2
func (m *Message) AsEnumerateInputEvents() *types.SIMCONNECT_RECV_ENUMERATE_INPUT_EVENTS
AsEnumerateInputEvents casts the message to SIMCONNECT_RECV_ENUMERATE_INPUT_EVENTS. Returns nil if the message is not an enumerate input events response. Note: MSFS 2024 only.
func (*Message) AsEvent ¶
func (m *Message) AsEvent() *types.SIMCONNECT_RECV_EVENT
func (*Message) AsEventFilename ¶
func (m *Message) AsEventFilename() *types.SIMCONNECT_RECV_EVENT_FILENAME
func (*Message) AsEventFrame ¶
func (m *Message) AsEventFrame() *types.SIMCONNECT_RECV_EVENT_FRAME
func (*Message) AsEventObjectAddRemove ¶ added in v0.1.2
func (m *Message) AsEventObjectAddRemove() *types.SIMCONNECT_RECV_EVENT_OBJECT_ADDREMOVE
func (*Message) AsException ¶
func (m *Message) AsException() *types.SIMCONNECT_RECV_EXCEPTION
func (*Message) AsFacilityData ¶
func (m *Message) AsFacilityData() *types.SIMCONNECT_RECV_FACILITY_DATA
func (*Message) AsFacilityDataEnd ¶ added in v0.3.7
func (m *Message) AsFacilityDataEnd() *types.SIMCONNECT_RECV_FACILITY_DATA_END
func (*Message) AsFacilityList ¶
func (m *Message) AsFacilityList() *types.SIMCONNECT_RECV_FACILITIES_LIST
func (*Message) AsFlowEvent ¶ added in v0.3.9
func (m *Message) AsFlowEvent() *types.SIMCONNECT_RECV_FLOW_EVENT
AsFlowEvent casts the message to SIMCONNECT_RECV_FLOW_EVENT. Returns nil if the message is not a flow event. Note: MSFS 2024 only.
func (*Message) AsGetInputEvent ¶ added in v0.4.2
func (m *Message) AsGetInputEvent() *types.SIMCONNECT_RECV_GET_INPUT_EVENT
AsGetInputEvent casts the message to SIMCONNECT_RECV_GET_INPUT_EVENT. Returns nil if the message is not a get input event response. Note: MSFS 2024 only.
func (*Message) AsNDBList ¶
func (m *Message) AsNDBList() *types.SIMCONNECT_RECV_NDB_LIST
func (*Message) AsOpen ¶
func (m *Message) AsOpen() *types.SIMCONNECT_RECV_OPEN
func (*Message) AsSimObjectAndLiveryEnumeration ¶
func (m *Message) AsSimObjectAndLiveryEnumeration() *types.SIMCONNECT_RECV_ENUMERATE_SIMOBJECT_AND_LIVERY_LIST
func (*Message) AsSimObjectData ¶
func (m *Message) AsSimObjectData() *types.SIMCONNECT_RECV_SIMOBJECT_DATA
func (*Message) AsSimObjectDataBType ¶
func (m *Message) AsSimObjectDataBType() *types.SIMCONNECT_RECV_SIMOBJECT_DATA_BTYPE
func (*Message) AsSubscribeInputEvent ¶ added in v0.4.2
func (m *Message) AsSubscribeInputEvent() *types.SIMCONNECT_RECV_SUBSCRIBE_INPUT_EVENT
AsSubscribeInputEvent casts the message to SIMCONNECT_RECV_SUBSCRIBE_INPUT_EVENT. Returns nil if the message is not a subscribe input event notification. Note: MSFS 2024 only.
func (*Message) AsVORList ¶
func (m *Message) AsVORList() *types.SIMCONNECT_RECV_VOR_LIST
func (*Message) AsWaypointList ¶
func (m *Message) AsWaypointList() *types.SIMCONNECT_RECV_WAYPOINT_LIST
type Option ¶
type Option func(*Config)
func WithAutoDetect ¶ added in v0.2.0
func WithAutoDetect() Option
WithAutoDetect enables automatic detection of SimConnect.dll by searching environment variables and common SDK installation paths. When enabled, detection runs regardless of any path set via WithDLLPath. If detection fails, the existing path (default or explicit) is kept as fallback.
func WithBufferSize ¶
func WithContext ¶
func WithDLLPath ¶
func WithHeartbeat ¶
func WithHeartbeat(frequency HeartbeatFrequency) Option
func WithLogLevel ¶
WithLogLevel sets the minimum log level for the default logger constructed by the engine when the caller does not provide a custom logger.
func WithLogLevelFromString ¶
WithLogLevelFromString parses a textual level (e.g. "debug", "info") and sets the effective log level on the config.