├── .gitignore ├── LICENSE ├── README.md ├── examples ├── 01_simconnect │ ├── main.go │ └── run.sh └── 02_simmate │ ├── main.go │ └── run.sh ├── go.mod ├── go.sum ├── references ├── SimConnect.h ├── simvars.txt ├── unique_units.txt └── units.txt └── simconnect ├── api.go ├── defs.go ├── simconnect.go ├── simmate.go ├── simvar.go ├── simvar_manager.go └── utils.go /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | # Test binary, built with `go test -c` 9 | *.test 10 | 11 | # Output of the go coverage tool, specifically when used with LiteIDE 12 | *.out 13 | 14 | # Dependency directories (remove the comment below to include it) 15 | # vendor/ 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Sascha Stojanov (grumpypixel@protonmail.com) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # msfs2020-simconnect-go 2 | 3 | This is a Golang interface for Microsoft Flight Simulator 2020 (MSFS2020 ) using SimConnect. 4 | 5 | ## Installation 6 | 7 | `$ go get github.com/grumpypixel/msfs2020-simconnect-go` 8 | 9 | ## Does it work? 10 | 11 | Yes, it does. This package was created to power the [msfs2020-gopilot](https://github.com/grumpypixel/msfs2020-gopilot). 12 | 13 | Please note that this interface is not complete, but a lot of the SimConnect functionality has been implemented. 14 | 15 | ## Where's the Documentation? 16 | 17 | Check out the official [SimConnect API Reference](https://docs.flightsimulator.com/html/index.htm#t=Programming_Tools%2FSimConnect%2FSimConnect_API_Reference.htm). 18 | 19 | Apart from that, there's no other documenation at the moment. Since this is still *work in progress* the code is your friend. 20 | 21 | So go ahead and have a look at the file [defs.go](https://github.com/grumpypixel/msfs2020-simconnect-go/blob/main/simconnect/defs.go) which is, more or less, the transfused code from SimConnect.h. 22 | 23 | ## Any Examples? 24 | 25 | At the time of writing, there are two simple [examples](https://github.com/grumpypixel/msfs2020-simconnect-go/tree/main/examples) available. 26 | 27 | [Example #1](https://github.com/grumpypixel/msfs2020-simconnect-go/blob/main/examples/01_simconnect/main.go) shows the basic [SimConnect](https://github.com/grumpypixel/msfs2020-simconnect-go/blob/main/simconnect/simconnect.go) interface. With this approach, you will need to manage all *simulation variables*, *requests* etc. yourself. This is most likely what you want. 28 | 29 | [Example #2](https://github.com/grumpypixel/msfs2020-simconnect-go/blob/main/examples/02_simmate/main.go) shows how to use the [SimMate](https://github.com/grumpypixel/msfs2020-simconnect-go/blob/main/simconnect/simmate.go), a convenience class where the [management](https://github.com/grumpypixel/msfs2020-simconnect-go/blob/main/simconnect/simvar_manager.go) of [SimVars](https://github.com/grumpypixel/msfs2020-simconnect-go/blob/main/simconnect/simvar.go) is handled for you. This encapsulation works for the [GoPilot](https://github.com/grumpypixel/msfs2020-gopilot) above mentioned, but it may not work for you. Just build your own - which is awesome because this package might get inspired by your creation and improvements. 30 | 31 | ## SimMate? Seriously? 32 | 33 | Because I didn't want to call it *Something* *Something* *Manager*, that's why. 34 | 35 | ## Do you suffer from naming paralysis from time to time? 36 | 37 | Yes. Way too often. But names do matter. And sometimes a stupid name is better than no name at all. 38 | 39 | Nonetheless. 40 | 41 | Cheers and Happy coding! 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /examples/01_simconnect/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "os/signal" 7 | "syscall" 8 | "time" 9 | 10 | "github.com/grumpypixel/msfs2020-simconnect-go/simconnect" 11 | ) 12 | 13 | type SimVar struct { 14 | DefineID simconnect.DWord 15 | Name, Unit string 16 | } 17 | 18 | type SimObjectValue struct { 19 | simconnect.RecvSimObjectDataByType 20 | Value float64 21 | } 22 | 23 | var ( 24 | requestDataInterval = time.Millisecond * 250 25 | receiveDataInterval = time.Millisecond * 1 26 | simConnect *simconnect.SimConnect 27 | simVars []*SimVar 28 | ) 29 | 30 | func main() { 31 | additionalSearchPath := "" 32 | args := os.Args 33 | if len(args) > 1 { 34 | additionalSearchPath = args[1] 35 | fmt.Println("searchpath", additionalSearchPath) 36 | } 37 | 38 | if err := simconnect.Initialize(additionalSearchPath); err != nil { 39 | panic(err) 40 | } 41 | 42 | simConnect = simconnect.NewSimConnect() 43 | if err := simConnect.Open("Transpotato"); err != nil { 44 | panic(err) 45 | } 46 | 47 | simVars = make([]*SimVar, 0) 48 | nameUnitMapping := map[string]string{"AIRSPEED INDICATED": "knot", "INDICATED ALTITUDE": "feet", "PLANE LATITUDE": "degrees", "PLANE LONGITUDE": "degrees"} 49 | for name, unit := range nameUnitMapping { 50 | defineID := simconnect.NewDefineID() 51 | simConnect.AddToDataDefinition(defineID, name, unit, simconnect.DataTypeFloat64) 52 | simVars = append(simVars, &SimVar{defineID, name, unit}) 53 | } 54 | 55 | done := make(chan bool, 1) 56 | defer close(done) 57 | go HandleTerminationSignal(done) 58 | go HandleEvents(done) 59 | 60 | <-done 61 | 62 | if err := simConnect.Close(); err != nil { 63 | panic(err) 64 | } 65 | } 66 | 67 | func HandleTerminationSignal(done chan bool) { 68 | sigterm := make(chan os.Signal, 1) 69 | defer close(sigterm) 70 | 71 | signal.Notify(sigterm, os.Interrupt, syscall.SIGTERM) 72 | for { 73 | select { 74 | case <-sigterm: 75 | done <- true 76 | return 77 | } 78 | } 79 | } 80 | 81 | func HandleEvents(done chan bool) { 82 | reqDataTicker := time.NewTicker(requestDataInterval) 83 | defer reqDataTicker.Stop() 84 | 85 | recvDataTicker := time.NewTicker(receiveDataInterval) 86 | defer recvDataTicker.Stop() 87 | 88 | var simObjectType = simconnect.SimObjectTypeUser 89 | var radius = simconnect.DWordZero 90 | 91 | for { 92 | select { 93 | case <-reqDataTicker.C: 94 | fmt.Println("\nRequesting data...") 95 | for _, simVar := range simVars { 96 | simConnect.RequestDataOnSimObjectType(simconnect.NewRequestID(), simVar.DefineID, radius, simObjectType) 97 | } 98 | 99 | case <-recvDataTicker.C: 100 | ppData, r1, err := simConnect.GetNextDispatch() 101 | if r1 < 0 { 102 | if uint32(r1) != simconnect.EFail { 103 | fmt.Printf("GetNextDispatch error: %d %s\n", r1, err) 104 | return 105 | } 106 | if ppData == nil { 107 | break 108 | } 109 | } 110 | 111 | recv := *(*simconnect.Recv)(ppData) 112 | switch recv.ID { 113 | case simconnect.RecvIDOpen: 114 | fmt.Println("Connected.") 115 | 116 | case simconnect.RecvIDQuit: 117 | fmt.Println("Disconnected.") 118 | done <- true 119 | 120 | case simconnect.RecvIDException: 121 | recvException := *(*simconnect.RecvException)(ppData) 122 | fmt.Println("Something exceptional happened.", recvException.Exception) 123 | 124 | case simconnect.RecvIDSimObjectDataByType: 125 | data := *(*SimObjectValue)(ppData) 126 | for _, simVar := range simVars { 127 | if simVar.DefineID == data.DefineID { 128 | fmt.Printf("[%d] %s %s %f\n", data.RequestID, simVar.Name, simVar.Unit, data.Value) 129 | break 130 | } 131 | } 132 | } 133 | } 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /examples/01_simconnect/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "This shell script assumes that the Simulator is running and the SimConnect.dll is located in the projects' root directory" 4 | go run main.go ../.. 5 | -------------------------------------------------------------------------------- /examples/02_simmate/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "os/signal" 7 | "syscall" 8 | "time" 9 | 10 | "github.com/grumpypixel/msfs2020-simconnect-go/simconnect" 11 | ) 12 | 13 | type Request struct { 14 | Name, Unit string 15 | DataType simconnect.DWord 16 | } 17 | 18 | type Var struct { 19 | DefineID simconnect.DWord 20 | Name string 21 | } 22 | 23 | type App struct { 24 | mate *simconnect.SimMate 25 | vars []*Var 26 | done chan interface{} 27 | counter uint32 28 | eventListener *simconnect.EventListener 29 | } 30 | 31 | var ( 32 | requestDataInterval = time.Millisecond * 250 33 | receiveDataInterval = time.Millisecond * 1 34 | mate *simconnect.SimMate 35 | ) 36 | 37 | func main() { 38 | additionalSearchPath := "" 39 | args := os.Args 40 | if len(args) > 1 { 41 | additionalSearchPath = args[1] 42 | fmt.Println("searchpath", additionalSearchPath) 43 | } 44 | 45 | if err := simconnect.Initialize(additionalSearchPath); err != nil { 46 | panic(err) 47 | } 48 | 49 | app := &App{} 50 | app.run() 51 | } 52 | 53 | func (app *App) run() { 54 | app.done = make(chan interface{}, 1) 55 | defer close(app.done) 56 | 57 | app.eventListener = &simconnect.EventListener{ 58 | OnOpen: app.OnOpen, 59 | OnQuit: app.OnQuit, 60 | OnDataReady: app.OnDataReady, 61 | OnEventID: app.OnEventID, 62 | OnException: app.OnException, 63 | } 64 | 65 | app.mate = simconnect.NewSimMate() 66 | 67 | if err := app.mate.Open("Transpotato"); err != nil { 68 | panic(err) 69 | } 70 | 71 | // These are the sim vars we are looking for 72 | requests := []Request{ 73 | {"AIRSPEED INDICATED", "knot", simconnect.DataTypeFloat64}, 74 | {"PLANE LATITUDE", "degrees", simconnect.DataTypeFloat64}, 75 | {"PLANE LONGITUDE", "degrees", simconnect.DataTypeFloat64}, 76 | {"PLANE HEADING DEGREES MAGNETIC", "degrees", simconnect.DataTypeFloat64}, 77 | {"TITLE", "", simconnect.DataTypeString256}, 78 | {"ATC ID", "", simconnect.DataTypeString64}, 79 | } 80 | app.vars = make([]*Var, 0) 81 | for _, request := range requests { 82 | defineID := app.mate.AddSimVar(request.Name, request.Unit, request.DataType) 83 | app.vars = append(app.vars, &Var{defineID, request.Name}) 84 | } 85 | 86 | go app.handleTerminationSignal() 87 | 88 | stop := make(chan interface{}, 1) 89 | defer close(stop) 90 | go app.mate.HandleEvents(requestDataInterval, receiveDataInterval, stop, app.eventListener) 91 | 92 | <-app.done 93 | stop <- true 94 | 95 | app.mate.Close() 96 | } 97 | 98 | func (app *App) handleTerminationSignal() { 99 | sigterm := make(chan os.Signal, 1) 100 | defer close(sigterm) 101 | 102 | signal.Notify(sigterm, os.Interrupt, syscall.SIGTERM) 103 | 104 | for { 105 | select { 106 | case <-sigterm: 107 | app.done <- true 108 | return 109 | } 110 | } 111 | } 112 | 113 | func (app *App) OnOpen(applName, applVersion, applBuild, simConnectVersion, simConnectBuild string) { 114 | fmt.Println("\nConnected.") 115 | flightSimVersion := fmt.Sprintf( 116 | "Flight Simulator:\n Name: %s\n Version: %s (build %s)\n SimConnect: %s (build %s)", 117 | applName, applVersion, applBuild, simConnectVersion, simConnectBuild) 118 | fmt.Printf("\n%s\n\n", flightSimVersion) 119 | fmt.Printf("CLEAR PROP!\n\n") 120 | } 121 | 122 | func (app *App) OnQuit() { 123 | fmt.Println("Disconnected.") 124 | app.done <- true 125 | } 126 | 127 | func (app *App) OnEventID(eventID simconnect.DWord) { 128 | fmt.Println("Received event ID", eventID) 129 | } 130 | 131 | func (app *App) OnException(exceptionCode simconnect.DWord) { 132 | fmt.Printf("Exception (code: %d)\n", exceptionCode) 133 | } 134 | 135 | func (app *App) OnDataReady() { 136 | fmt.Printf("\nUpdate %d...\n", app.counter) 137 | app.counter++ 138 | for _, v := range app.vars { 139 | value, _, ok := app.mate.SimVarValueAndDataType(v.DefineID) 140 | if !ok || value == nil { 141 | continue 142 | } 143 | fmt.Printf("%s = %v\n", v.Name, value) 144 | } 145 | } 146 | -------------------------------------------------------------------------------- /examples/02_simmate/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "This shell script assumes that the Simulator is running and the SimConnect.dll is located in the projects' root directory" 4 | go run main.go ../.. 5 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/grumpypixel/msfs2020-simconnect-go 2 | 3 | go 1.17 4 | 5 | require github.com/sirupsen/logrus v1.8.1 6 | 7 | require golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 // indirect 8 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 2 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 3 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 4 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 5 | github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE= 6 | github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= 7 | github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= 8 | github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 9 | golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4= 10 | golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 11 | -------------------------------------------------------------------------------- /references/SimConnect.h: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------------- 2 | // 3 | // Copyright (c) Microsoft Corporation. All Rights Reserved. 4 | // 5 | //----------------------------------------------------------------------------- 6 | 7 | #ifndef _SIMCONNECT_H_ 8 | #define _SIMCONNECT_H_ 9 | 10 | #pragma once 11 | 12 | #ifdef _MSFS_WASM 13 | #ifndef SIMCONNECT_WASM_MODULE 14 | #define SIMCONNECT_WASM_MODULE "env" 15 | #endif 16 | #endif 17 | 18 | #ifndef DWORD_MAX 19 | #define DWORD_MAX 0xFFFFFFFF 20 | #endif 21 | 22 | #include 23 | 24 | typedef DWORD SIMCONNECT_OBJECT_ID; 25 | 26 | //---------------------------------------------------------------------------- 27 | // Constants 28 | //---------------------------------------------------------------------------- 29 | 30 | static const DWORD SIMCONNECT_UNUSED = DWORD_MAX; // special value to indicate unused event, ID 31 | static const DWORD SIMCONNECT_OBJECT_ID_USER = 0; // proxy value for User vehicle ObjectID 32 | 33 | static const float SIMCONNECT_CAMERA_IGNORE_FIELD = FLT_MAX; //Used to tell the Camera API to NOT modify the value in this part of the argument. 34 | 35 | static const DWORD SIMCONNECT_CLIENTDATA_MAX_SIZE = 8192; // maximum value for SimConnect_CreateClientData dwSize parameter 36 | 37 | 38 | // Notification Group priority values 39 | static const DWORD SIMCONNECT_GROUP_PRIORITY_HIGHEST = 1; // highest priority 40 | static const DWORD SIMCONNECT_GROUP_PRIORITY_HIGHEST_MASKABLE = 10000000; // highest priority that allows events to be masked 41 | static const DWORD SIMCONNECT_GROUP_PRIORITY_STANDARD = 1900000000; // standard priority 42 | static const DWORD SIMCONNECT_GROUP_PRIORITY_DEFAULT = 2000000000; // default priority 43 | static const DWORD SIMCONNECT_GROUP_PRIORITY_LOWEST = 4000000000; // priorities lower than this will be ignored 44 | 45 | //Weather observations Metar strings 46 | static const DWORD MAX_METAR_LENGTH = 2000; 47 | 48 | // Maximum thermal size is 100 km. 49 | static const float MAX_THERMAL_SIZE = 100000; 50 | static const float MAX_THERMAL_RATE = 1000; 51 | 52 | // SIMCONNECT_DATA_INITPOSITION.Airspeed 53 | static const DWORD INITPOSITION_AIRSPEED_CRUISE = -1; // aircraft's cruise airspeed 54 | static const DWORD INITPOSITION_AIRSPEED_KEEP = -2; // keep current airspeed 55 | 56 | // AddToClientDataDefinition dwSizeOrType parameter type values 57 | static const DWORD SIMCONNECT_CLIENTDATATYPE_INT8 = -1; // 8-bit integer number 58 | static const DWORD SIMCONNECT_CLIENTDATATYPE_INT16 = -2; // 16-bit integer number 59 | static const DWORD SIMCONNECT_CLIENTDATATYPE_INT32 = -3; // 32-bit integer number 60 | static const DWORD SIMCONNECT_CLIENTDATATYPE_INT64 = -4; // 64-bit integer number 61 | static const DWORD SIMCONNECT_CLIENTDATATYPE_FLOAT32 = -5; // 32-bit floating-point number (float) 62 | static const DWORD SIMCONNECT_CLIENTDATATYPE_FLOAT64 = -6; // 64-bit floating-point number (double) 63 | 64 | // AddToClientDataDefinition dwOffset parameter special values 65 | static const DWORD SIMCONNECT_CLIENTDATAOFFSET_AUTO = -1; // automatically compute offset of the ClientData variable 66 | 67 | // Open ConfigIndex parameter special value 68 | static const DWORD SIMCONNECT_OPEN_CONFIGINDEX_LOCAL = -1; // ignore SimConnect.cfg settings, and force local connection 69 | 70 | //---------------------------------------------------------------------------- 71 | // Enum definitions 72 | //---------------------------------------------------------------------------- 73 | 74 | //these came from substituteMacros 75 | #define SIMCONNECT_REFSTRUCT struct 76 | #define SIMCONNECT_STRUCT struct 77 | #define SIMCONNECT_STRING(name, size) char name[size] 78 | #define SIMCONNECT_GUID GUID 79 | #define SIMCONNECT_STRINGV(name) char name[1] 80 | #define SIMCONNECT_DATAV(name, id, count) DWORD name 81 | #define SIMCONNECT_FIXEDTYPE_DATAV(type, name, count, cliMarshalAs, cliType) type name[1] 82 | #define SIMCONNECT_GUID GUID 83 | #define SIMCONNECT_ENUM enum 84 | #define SIMCONNECT_ENUM_FLAGS typedef DWORD 85 | #define SIMCONNECT_USER_ENUM typedef DWORD 86 | 87 | 88 | // Receive data types 89 | SIMCONNECT_ENUM SIMCONNECT_RECV_ID { 90 | SIMCONNECT_RECV_ID_NULL, 91 | SIMCONNECT_RECV_ID_EXCEPTION, 92 | SIMCONNECT_RECV_ID_OPEN, 93 | SIMCONNECT_RECV_ID_QUIT, 94 | SIMCONNECT_RECV_ID_EVENT, 95 | SIMCONNECT_RECV_ID_EVENT_OBJECT_ADDREMOVE, 96 | SIMCONNECT_RECV_ID_EVENT_FILENAME, 97 | SIMCONNECT_RECV_ID_EVENT_FRAME, 98 | SIMCONNECT_RECV_ID_SIMOBJECT_DATA, 99 | SIMCONNECT_RECV_ID_SIMOBJECT_DATA_BYTYPE, 100 | SIMCONNECT_RECV_ID_WEATHER_OBSERVATION, 101 | SIMCONNECT_RECV_ID_CLOUD_STATE, 102 | SIMCONNECT_RECV_ID_ASSIGNED_OBJECT_ID, 103 | SIMCONNECT_RECV_ID_RESERVED_KEY, 104 | SIMCONNECT_RECV_ID_CUSTOM_ACTION, 105 | SIMCONNECT_RECV_ID_SYSTEM_STATE, 106 | SIMCONNECT_RECV_ID_CLIENT_DATA, 107 | SIMCONNECT_RECV_ID_EVENT_WEATHER_MODE, 108 | SIMCONNECT_RECV_ID_AIRPORT_LIST, 109 | SIMCONNECT_RECV_ID_VOR_LIST, 110 | SIMCONNECT_RECV_ID_NDB_LIST, 111 | SIMCONNECT_RECV_ID_WAYPOINT_LIST, 112 | SIMCONNECT_RECV_ID_EVENT_MULTIPLAYER_SERVER_STARTED, 113 | SIMCONNECT_RECV_ID_EVENT_MULTIPLAYER_CLIENT_STARTED, 114 | SIMCONNECT_RECV_ID_EVENT_MULTIPLAYER_SESSION_ENDED, 115 | SIMCONNECT_RECV_ID_EVENT_RACE_END, 116 | SIMCONNECT_RECV_ID_EVENT_RACE_LAP, 117 | #ifdef ENABLE_SIMCONNECT_EXPERIMENTAL 118 | SIMCONNECT_RECV_ID_PICK, 119 | #endif //ENABLE_SIMCONNECT_EXPERIMENTAL 120 | }; 121 | 122 | 123 | 124 | // Data data types 125 | SIMCONNECT_ENUM SIMCONNECT_DATATYPE { 126 | SIMCONNECT_DATATYPE_INVALID, // invalid data type 127 | SIMCONNECT_DATATYPE_INT32, // 32-bit integer number 128 | SIMCONNECT_DATATYPE_INT64, // 64-bit integer number 129 | SIMCONNECT_DATATYPE_FLOAT32, // 32-bit floating-point number (float) 130 | SIMCONNECT_DATATYPE_FLOAT64, // 64-bit floating-point number (double) 131 | SIMCONNECT_DATATYPE_STRING8, // 8-byte string 132 | SIMCONNECT_DATATYPE_STRING32, // 32-byte string 133 | SIMCONNECT_DATATYPE_STRING64, // 64-byte string 134 | SIMCONNECT_DATATYPE_STRING128, // 128-byte string 135 | SIMCONNECT_DATATYPE_STRING256, // 256-byte string 136 | SIMCONNECT_DATATYPE_STRING260, // 260-byte string 137 | SIMCONNECT_DATATYPE_STRINGV, // variable-length string 138 | 139 | SIMCONNECT_DATATYPE_INITPOSITION, // see SIMCONNECT_DATA_INITPOSITION 140 | SIMCONNECT_DATATYPE_MARKERSTATE, // see SIMCONNECT_DATA_MARKERSTATE 141 | SIMCONNECT_DATATYPE_WAYPOINT, // see SIMCONNECT_DATA_WAYPOINT 142 | SIMCONNECT_DATATYPE_LATLONALT, // see SIMCONNECT_DATA_LATLONALT 143 | SIMCONNECT_DATATYPE_XYZ, // see SIMCONNECT_DATA_XYZ 144 | 145 | SIMCONNECT_DATATYPE_MAX // enum limit 146 | }; 147 | 148 | // Exception error types 149 | SIMCONNECT_ENUM SIMCONNECT_EXCEPTION { 150 | SIMCONNECT_EXCEPTION_NONE, 151 | 152 | SIMCONNECT_EXCEPTION_ERROR, 153 | SIMCONNECT_EXCEPTION_SIZE_MISMATCH, 154 | SIMCONNECT_EXCEPTION_UNRECOGNIZED_ID, 155 | SIMCONNECT_EXCEPTION_UNOPENED, 156 | SIMCONNECT_EXCEPTION_VERSION_MISMATCH, 157 | SIMCONNECT_EXCEPTION_TOO_MANY_GROUPS, 158 | SIMCONNECT_EXCEPTION_NAME_UNRECOGNIZED, 159 | SIMCONNECT_EXCEPTION_TOO_MANY_EVENT_NAMES, 160 | SIMCONNECT_EXCEPTION_EVENT_ID_DUPLICATE, 161 | SIMCONNECT_EXCEPTION_TOO_MANY_MAPS, 162 | SIMCONNECT_EXCEPTION_TOO_MANY_OBJECTS, 163 | SIMCONNECT_EXCEPTION_TOO_MANY_REQUESTS, 164 | SIMCONNECT_EXCEPTION_WEATHER_INVALID_PORT, 165 | SIMCONNECT_EXCEPTION_WEATHER_INVALID_METAR, 166 | SIMCONNECT_EXCEPTION_WEATHER_UNABLE_TO_GET_OBSERVATION, 167 | SIMCONNECT_EXCEPTION_WEATHER_UNABLE_TO_CREATE_STATION, 168 | SIMCONNECT_EXCEPTION_WEATHER_UNABLE_TO_REMOVE_STATION, 169 | SIMCONNECT_EXCEPTION_INVALID_DATA_TYPE, 170 | SIMCONNECT_EXCEPTION_INVALID_DATA_SIZE, 171 | SIMCONNECT_EXCEPTION_DATA_ERROR, 172 | SIMCONNECT_EXCEPTION_INVALID_ARRAY, 173 | SIMCONNECT_EXCEPTION_CREATE_OBJECT_FAILED, 174 | SIMCONNECT_EXCEPTION_LOAD_FLIGHTPLAN_FAILED, 175 | SIMCONNECT_EXCEPTION_OPERATION_INVALID_FOR_OBJECT_TYPE, 176 | SIMCONNECT_EXCEPTION_ILLEGAL_OPERATION, 177 | SIMCONNECT_EXCEPTION_ALREADY_SUBSCRIBED, 178 | SIMCONNECT_EXCEPTION_INVALID_ENUM, 179 | SIMCONNECT_EXCEPTION_DEFINITION_ERROR, 180 | SIMCONNECT_EXCEPTION_DUPLICATE_ID, 181 | SIMCONNECT_EXCEPTION_DATUM_ID, 182 | SIMCONNECT_EXCEPTION_OUT_OF_BOUNDS, 183 | SIMCONNECT_EXCEPTION_ALREADY_CREATED, 184 | SIMCONNECT_EXCEPTION_OBJECT_OUTSIDE_REALITY_BUBBLE, 185 | SIMCONNECT_EXCEPTION_OBJECT_CONTAINER, 186 | SIMCONNECT_EXCEPTION_OBJECT_AI, 187 | SIMCONNECT_EXCEPTION_OBJECT_ATC, 188 | SIMCONNECT_EXCEPTION_OBJECT_SCHEDULE, 189 | }; 190 | 191 | // Object types 192 | SIMCONNECT_ENUM SIMCONNECT_SIMOBJECT_TYPE { 193 | SIMCONNECT_SIMOBJECT_TYPE_USER, 194 | SIMCONNECT_SIMOBJECT_TYPE_ALL, 195 | SIMCONNECT_SIMOBJECT_TYPE_AIRCRAFT, 196 | SIMCONNECT_SIMOBJECT_TYPE_HELICOPTER, 197 | SIMCONNECT_SIMOBJECT_TYPE_BOAT, 198 | SIMCONNECT_SIMOBJECT_TYPE_GROUND, 199 | }; 200 | 201 | // EventState values 202 | SIMCONNECT_ENUM SIMCONNECT_STATE { 203 | SIMCONNECT_STATE_OFF, 204 | SIMCONNECT_STATE_ON, 205 | }; 206 | 207 | // Object Data Request Period values 208 | SIMCONNECT_ENUM SIMCONNECT_PERIOD { 209 | SIMCONNECT_PERIOD_NEVER, 210 | SIMCONNECT_PERIOD_ONCE, 211 | SIMCONNECT_PERIOD_VISUAL_FRAME, 212 | SIMCONNECT_PERIOD_SIM_FRAME, 213 | SIMCONNECT_PERIOD_SECOND, 214 | }; 215 | 216 | 217 | SIMCONNECT_ENUM SIMCONNECT_MISSION_END { 218 | SIMCONNECT_MISSION_FAILED, 219 | SIMCONNECT_MISSION_CRASHED, 220 | SIMCONNECT_MISSION_SUCCEEDED 221 | }; 222 | 223 | // ClientData Request Period values 224 | SIMCONNECT_ENUM SIMCONNECT_CLIENT_DATA_PERIOD { 225 | SIMCONNECT_CLIENT_DATA_PERIOD_NEVER, 226 | SIMCONNECT_CLIENT_DATA_PERIOD_ONCE, 227 | SIMCONNECT_CLIENT_DATA_PERIOD_VISUAL_FRAME, 228 | SIMCONNECT_CLIENT_DATA_PERIOD_ON_SET, 229 | SIMCONNECT_CLIENT_DATA_PERIOD_SECOND, 230 | }; 231 | 232 | SIMCONNECT_ENUM SIMCONNECT_TEXT_TYPE { 233 | SIMCONNECT_TEXT_TYPE_SCROLL_BLACK, 234 | SIMCONNECT_TEXT_TYPE_SCROLL_WHITE, 235 | SIMCONNECT_TEXT_TYPE_SCROLL_RED, 236 | SIMCONNECT_TEXT_TYPE_SCROLL_GREEN, 237 | SIMCONNECT_TEXT_TYPE_SCROLL_BLUE, 238 | SIMCONNECT_TEXT_TYPE_SCROLL_YELLOW, 239 | SIMCONNECT_TEXT_TYPE_SCROLL_MAGENTA, 240 | SIMCONNECT_TEXT_TYPE_SCROLL_CYAN, 241 | SIMCONNECT_TEXT_TYPE_PRINT_BLACK=0x0100, 242 | SIMCONNECT_TEXT_TYPE_PRINT_WHITE, 243 | SIMCONNECT_TEXT_TYPE_PRINT_RED, 244 | SIMCONNECT_TEXT_TYPE_PRINT_GREEN, 245 | SIMCONNECT_TEXT_TYPE_PRINT_BLUE, 246 | SIMCONNECT_TEXT_TYPE_PRINT_YELLOW, 247 | SIMCONNECT_TEXT_TYPE_PRINT_MAGENTA, 248 | SIMCONNECT_TEXT_TYPE_PRINT_CYAN, 249 | SIMCONNECT_TEXT_TYPE_MENU=0x0200, 250 | }; 251 | 252 | SIMCONNECT_ENUM SIMCONNECT_TEXT_RESULT { 253 | SIMCONNECT_TEXT_RESULT_MENU_SELECT_1, 254 | SIMCONNECT_TEXT_RESULT_MENU_SELECT_2, 255 | SIMCONNECT_TEXT_RESULT_MENU_SELECT_3, 256 | SIMCONNECT_TEXT_RESULT_MENU_SELECT_4, 257 | SIMCONNECT_TEXT_RESULT_MENU_SELECT_5, 258 | SIMCONNECT_TEXT_RESULT_MENU_SELECT_6, 259 | SIMCONNECT_TEXT_RESULT_MENU_SELECT_7, 260 | SIMCONNECT_TEXT_RESULT_MENU_SELECT_8, 261 | SIMCONNECT_TEXT_RESULT_MENU_SELECT_9, 262 | SIMCONNECT_TEXT_RESULT_MENU_SELECT_10, 263 | SIMCONNECT_TEXT_RESULT_DISPLAYED = 0x00010000, 264 | SIMCONNECT_TEXT_RESULT_QUEUED, 265 | SIMCONNECT_TEXT_RESULT_REMOVED, 266 | SIMCONNECT_TEXT_RESULT_REPLACED, 267 | SIMCONNECT_TEXT_RESULT_TIMEOUT, 268 | }; 269 | 270 | SIMCONNECT_ENUM SIMCONNECT_WEATHER_MODE { 271 | SIMCONNECT_WEATHER_MODE_THEME, 272 | SIMCONNECT_WEATHER_MODE_RWW, 273 | SIMCONNECT_WEATHER_MODE_CUSTOM, 274 | SIMCONNECT_WEATHER_MODE_GLOBAL, 275 | }; 276 | 277 | SIMCONNECT_ENUM SIMCONNECT_FACILITY_LIST_TYPE { 278 | SIMCONNECT_FACILITY_LIST_TYPE_AIRPORT, 279 | SIMCONNECT_FACILITY_LIST_TYPE_WAYPOINT, 280 | SIMCONNECT_FACILITY_LIST_TYPE_NDB, 281 | SIMCONNECT_FACILITY_LIST_TYPE_VOR, 282 | SIMCONNECT_FACILITY_LIST_TYPE_COUNT // invalid 283 | }; 284 | 285 | 286 | SIMCONNECT_ENUM_FLAGS SIMCONNECT_VOR_FLAGS; // flags for SIMCONNECT_RECV_ID_VOR_LIST 287 | static const DWORD SIMCONNECT_RECV_ID_VOR_LIST_HAS_NAV_SIGNAL = 0x00000001; // Has Nav signal 288 | static const DWORD SIMCONNECT_RECV_ID_VOR_LIST_HAS_LOCALIZER = 0x00000002; // Has localizer 289 | static const DWORD SIMCONNECT_RECV_ID_VOR_LIST_HAS_GLIDE_SLOPE = 0x00000004; // Has Nav signal 290 | static const DWORD SIMCONNECT_RECV_ID_VOR_LIST_HAS_DME = 0x00000008; // Station has DME 291 | 292 | 293 | 294 | // bits for the Waypoint Flags field: may be combined 295 | SIMCONNECT_ENUM_FLAGS SIMCONNECT_WAYPOINT_FLAGS; 296 | static const DWORD SIMCONNECT_WAYPOINT_NONE = 0x00; 297 | static const DWORD SIMCONNECT_WAYPOINT_SPEED_REQUESTED = 0x04; // requested speed at waypoint is valid 298 | static const DWORD SIMCONNECT_WAYPOINT_THROTTLE_REQUESTED = 0x08; // request a specific throttle percentage 299 | static const DWORD SIMCONNECT_WAYPOINT_COMPUTE_VERTICAL_SPEED = 0x10; // compute vertical to speed to reach waypoint altitude when crossing the waypoint 300 | static const DWORD SIMCONNECT_WAYPOINT_ALTITUDE_IS_AGL = 0x20; // AltitudeIsAGL 301 | static const DWORD SIMCONNECT_WAYPOINT_ON_GROUND = 0x00100000; // place this waypoint on the ground 302 | static const DWORD SIMCONNECT_WAYPOINT_REVERSE = 0x00200000; // Back up to this waypoint. Only valid on first waypoint 303 | static const DWORD SIMCONNECT_WAYPOINT_WRAP_TO_FIRST = 0x00400000; // Wrap around back to first waypoint. Only valid on last waypoint. 304 | 305 | SIMCONNECT_ENUM_FLAGS SIMCONNECT_EVENT_FLAG; 306 | static const DWORD SIMCONNECT_EVENT_FLAG_DEFAULT = 0x00000000; 307 | static const DWORD SIMCONNECT_EVENT_FLAG_FAST_REPEAT_TIMER = 0x00000001; // set event repeat timer to simulate fast repeat 308 | static const DWORD SIMCONNECT_EVENT_FLAG_SLOW_REPEAT_TIMER = 0x00000002; // set event repeat timer to simulate slow repeat 309 | static const DWORD SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY = 0x00000010; // interpret GroupID parameter as priority value 310 | 311 | SIMCONNECT_ENUM_FLAGS SIMCONNECT_DATA_REQUEST_FLAG; 312 | static const DWORD SIMCONNECT_DATA_REQUEST_FLAG_DEFAULT = 0x00000000; 313 | static const DWORD SIMCONNECT_DATA_REQUEST_FLAG_CHANGED = 0x00000001; // send requested data when value(s) change 314 | static const DWORD SIMCONNECT_DATA_REQUEST_FLAG_TAGGED = 0x00000002; // send requested data in tagged format 315 | 316 | SIMCONNECT_ENUM_FLAGS SIMCONNECT_DATA_SET_FLAG; 317 | static const DWORD SIMCONNECT_DATA_SET_FLAG_DEFAULT = 0x00000000; 318 | static const DWORD SIMCONNECT_DATA_SET_FLAG_TAGGED = 0x00000001; // data is in tagged format 319 | 320 | SIMCONNECT_ENUM_FLAGS SIMCONNECT_CREATE_CLIENT_DATA_FLAG; 321 | static const DWORD SIMCONNECT_CREATE_CLIENT_DATA_FLAG_DEFAULT = 0x00000000; 322 | static const DWORD SIMCONNECT_CREATE_CLIENT_DATA_FLAG_READ_ONLY = 0x00000001; // permit only ClientData creator to write into ClientData 323 | 324 | 325 | SIMCONNECT_ENUM_FLAGS SIMCONNECT_CLIENT_DATA_REQUEST_FLAG; 326 | static const DWORD SIMCONNECT_CLIENT_DATA_REQUEST_FLAG_DEFAULT = 0x00000000; 327 | static const DWORD SIMCONNECT_CLIENT_DATA_REQUEST_FLAG_CHANGED = 0x00000001; // send requested ClientData when value(s) change 328 | static const DWORD SIMCONNECT_CLIENT_DATA_REQUEST_FLAG_TAGGED = 0x00000002; // send requested ClientData in tagged format 329 | 330 | SIMCONNECT_ENUM_FLAGS SIMCONNECT_CLIENT_DATA_SET_FLAG; 331 | static const DWORD SIMCONNECT_CLIENT_DATA_SET_FLAG_DEFAULT = 0x00000000; 332 | static const DWORD SIMCONNECT_CLIENT_DATA_SET_FLAG_TAGGED = 0x00000001; // data is in tagged format 333 | 334 | 335 | SIMCONNECT_ENUM_FLAGS SIMCONNECT_VIEW_SYSTEM_EVENT_DATA; // dwData contains these flags for the "View" System Event 336 | static const DWORD SIMCONNECT_VIEW_SYSTEM_EVENT_DATA_COCKPIT_2D = 0x00000001; // 2D Panels in cockpit view 337 | static const DWORD SIMCONNECT_VIEW_SYSTEM_EVENT_DATA_COCKPIT_VIRTUAL = 0x00000002; // Virtual (3D) panels in cockpit view 338 | static const DWORD SIMCONNECT_VIEW_SYSTEM_EVENT_DATA_ORTHOGONAL = 0x00000004; // Orthogonal (Map) view 339 | 340 | SIMCONNECT_ENUM_FLAGS SIMCONNECT_SOUND_SYSTEM_EVENT_DATA; // dwData contains these flags for the "Sound" System Event 341 | static const DWORD SIMCONNECT_SOUND_SYSTEM_EVENT_DATA_MASTER = 0x00000001; // Sound Master 342 | 343 | 344 | #ifdef ENABLE_SIMCONNECT_EXPERIMENTAL 345 | 346 | SIMCONNECT_ENUM_FLAGS SIMCONNECT_PICK_FLAGS 347 | { 348 | SIMCONNECT_PICK_GROUND = 0x01, // pick ground/ pick result item is ground location 349 | SIMCONNECT_PICK_AI = 0x02, // pick AI / pick result item is AI, (dwSimObjectID is valid) 350 | SIMCONNECT_PICK_SCENERY = 0x04, // pick scenery/ pick result item is scenery object (hSceneryObject is valid) 351 | SIMCONNECT_PICK_ALL = SIMCONNECT_PICK_SCENERY | SIMCONNECT_PICK_AI | SIMCONNECT_PICK_GROUND, // pick all / (not valid on pick result item) 352 | SIMCONNECT_PICK_COORDSASPIXELS = 0x08, 353 | }; 354 | 355 | #endif //ENABLE_SIMCONNECT_EXPERIMENTAL 356 | 357 | //---------------------------------------------------------------------------- 358 | // User-defined enums 359 | //---------------------------------------------------------------------------- 360 | 361 | SIMCONNECT_USER_ENUM SIMCONNECT_NOTIFICATION_GROUP_ID; //client-defined notification group ID 362 | SIMCONNECT_USER_ENUM SIMCONNECT_INPUT_GROUP_ID; //client-defined input group ID 363 | SIMCONNECT_USER_ENUM SIMCONNECT_DATA_DEFINITION_ID; //client-defined data definition ID 364 | SIMCONNECT_USER_ENUM SIMCONNECT_DATA_REQUEST_ID; //client-defined request data ID 365 | 366 | SIMCONNECT_USER_ENUM SIMCONNECT_CLIENT_EVENT_ID; //client-defined client event ID 367 | SIMCONNECT_USER_ENUM SIMCONNECT_CLIENT_DATA_ID; //client-defined client data ID 368 | SIMCONNECT_USER_ENUM SIMCONNECT_CLIENT_DATA_DEFINITION_ID; //client-defined client data definition ID 369 | 370 | 371 | //---------------------------------------------------------------------------- 372 | // Struct definitions 373 | //---------------------------------------------------------------------------- 374 | 375 | #pragma pack(push, 1) 376 | 377 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV 378 | { 379 | DWORD dwSize; // record size 380 | DWORD dwVersion; // interface version 381 | DWORD dwID; // see SIMCONNECT_RECV_ID 382 | }; 383 | 384 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_EXCEPTION : public SIMCONNECT_RECV // when dwID == SIMCONNECT_RECV_ID_EXCEPTION 385 | { 386 | DWORD dwException; // see SIMCONNECT_EXCEPTION 387 | static const DWORD UNKNOWN_SENDID = 0; 388 | DWORD dwSendID; // see SimConnect_GetLastSentPacketID 389 | static const DWORD UNKNOWN_INDEX = DWORD_MAX; 390 | DWORD dwIndex; // index of parameter that was source of error 391 | }; 392 | 393 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_OPEN : public SIMCONNECT_RECV // when dwID == SIMCONNECT_RECV_ID_OPEN 394 | { 395 | SIMCONNECT_STRING( szApplicationName, 256); 396 | DWORD dwApplicationVersionMajor; 397 | DWORD dwApplicationVersionMinor; 398 | DWORD dwApplicationBuildMajor; 399 | DWORD dwApplicationBuildMinor; 400 | DWORD dwSimConnectVersionMajor; 401 | DWORD dwSimConnectVersionMinor; 402 | DWORD dwSimConnectBuildMajor; 403 | DWORD dwSimConnectBuildMinor; 404 | DWORD dwReserved1; 405 | DWORD dwReserved2; 406 | }; 407 | 408 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_QUIT : public SIMCONNECT_RECV // when dwID == SIMCONNECT_RECV_ID_QUIT 409 | { 410 | }; 411 | 412 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_EVENT : public SIMCONNECT_RECV // when dwID == SIMCONNECT_RECV_ID_EVENT 413 | { 414 | static const DWORD UNKNOWN_GROUP = DWORD_MAX; 415 | DWORD uGroupID; 416 | DWORD uEventID; 417 | DWORD dwData; // uEventID-dependent context 418 | }; 419 | 420 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_EVENT_FILENAME : public SIMCONNECT_RECV_EVENT // when dwID == SIMCONNECT_RECV_ID_EVENT_FILENAME 421 | { 422 | SIMCONNECT_STRING( szFileName, MAX_PATH); // uEventID-dependent context 423 | DWORD dwFlags; 424 | }; 425 | 426 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_EVENT_OBJECT_ADDREMOVE : public SIMCONNECT_RECV_EVENT // when dwID == SIMCONNECT_RECV_ID_EVENT_FILENAME 427 | { 428 | SIMCONNECT_SIMOBJECT_TYPE eObjType; 429 | }; 430 | 431 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_EVENT_FRAME : public SIMCONNECT_RECV_EVENT // when dwID == SIMCONNECT_RECV_ID_EVENT_FRAME 432 | { 433 | float fFrameRate; 434 | float fSimSpeed; 435 | }; 436 | 437 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_EVENT_MULTIPLAYER_SERVER_STARTED : public SIMCONNECT_RECV_EVENT // when dwID == SIMCONNECT_RECV_ID_EVENT_MULTIPLAYER_SERVER_STARTED 438 | { 439 | // No event specific data, for now 440 | }; 441 | 442 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_EVENT_MULTIPLAYER_CLIENT_STARTED : public SIMCONNECT_RECV_EVENT // when dwID == SIMCONNECT_RECV_ID_EVENT_MULTIPLAYER_CLIENT_STARTED 443 | { 444 | // No event specific data, for now 445 | }; 446 | 447 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_EVENT_MULTIPLAYER_SESSION_ENDED : public SIMCONNECT_RECV_EVENT // when dwID == SIMCONNECT_RECV_ID_EVENT_MULTIPLAYER_SESSION_ENDED 448 | { 449 | // No event specific data, for now 450 | }; 451 | 452 | // SIMCONNECT_DATA_RACE_RESULT 453 | SIMCONNECT_STRUCT SIMCONNECT_DATA_RACE_RESULT 454 | { 455 | DWORD dwNumberOfRacers; // The total number of racers 456 | SIMCONNECT_GUID MissionGUID; // The name of the mission to execute, NULL if no mission 457 | SIMCONNECT_STRING( szPlayerName, MAX_PATH); // The name of the player 458 | SIMCONNECT_STRING( szSessionType, MAX_PATH); // The type of the multiplayer session: "LAN", "GAMESPY") 459 | SIMCONNECT_STRING( szAircraft, MAX_PATH); // The aircraft type 460 | SIMCONNECT_STRING( szPlayerRole, MAX_PATH); // The player role in the mission 461 | double fTotalTime; // Total time in seconds, 0 means DNF 462 | double fPenaltyTime; // Total penalty time in seconds 463 | DWORD dwIsDisqualified; // non 0 - disqualified, 0 - not disqualified 464 | }; 465 | 466 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_EVENT_RACE_END : public SIMCONNECT_RECV_EVENT // when dwID == SIMCONNECT_RECV_ID_EVENT_RACE_END 467 | { 468 | DWORD dwRacerNumber; // The index of the racer the results are for 469 | SIMCONNECT_DATA_RACE_RESULT RacerData; 470 | }; 471 | 472 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_EVENT_RACE_LAP : public SIMCONNECT_RECV_EVENT // when dwID == SIMCONNECT_RECV_ID_EVENT_RACE_LAP 473 | { 474 | DWORD dwLapIndex; // The index of the lap the results are for 475 | SIMCONNECT_DATA_RACE_RESULT RacerData; 476 | }; 477 | 478 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_SIMOBJECT_DATA : public SIMCONNECT_RECV // when dwID == SIMCONNECT_RECV_ID_SIMOBJECT_DATA 479 | { 480 | DWORD dwRequestID; 481 | DWORD dwObjectID; 482 | DWORD dwDefineID; 483 | DWORD dwFlags; // SIMCONNECT_DATA_REQUEST_FLAG 484 | DWORD dwentrynumber; // if multiple objects returned, this is number out of . 485 | DWORD dwoutof; // note: starts with 1, not 0. 486 | DWORD dwDefineCount; // data count (number of datums, *not* byte count) 487 | SIMCONNECT_DATAV( dwData, dwDefineID, ); // data begins here, dwDefineCount data items 488 | }; 489 | 490 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_SIMOBJECT_DATA_BYTYPE : public SIMCONNECT_RECV_SIMOBJECT_DATA // when dwID == SIMCONNECT_RECV_ID_SIMOBJECT_DATA_BYTYPE 491 | { 492 | }; 493 | 494 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_CLIENT_DATA : public SIMCONNECT_RECV_SIMOBJECT_DATA // when dwID == SIMCONNECT_RECV_ID_CLIENT_DATA 495 | { 496 | }; 497 | 498 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_WEATHER_OBSERVATION : public SIMCONNECT_RECV // when dwID == SIMCONNECT_RECV_ID_WEATHER_OBSERVATION 499 | { 500 | DWORD dwRequestID; 501 | SIMCONNECT_STRINGV( szMetar); // Variable length string whose maximum size is MAX_METAR_LENGTH 502 | }; 503 | 504 | static const int SIMCONNECT_CLOUD_STATE_ARRAY_WIDTH = 64; 505 | static const int SIMCONNECT_CLOUD_STATE_ARRAY_SIZE = SIMCONNECT_CLOUD_STATE_ARRAY_WIDTH*SIMCONNECT_CLOUD_STATE_ARRAY_WIDTH; 506 | 507 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_CLOUD_STATE : public SIMCONNECT_RECV // when dwID == SIMCONNECT_RECV_ID_CLOUD_STATE 508 | { 509 | DWORD dwRequestID; 510 | DWORD dwArraySize; 511 | SIMCONNECT_FIXEDTYPE_DATAV(BYTE, rgbData, dwArraySize, U1 /*member of UnmanagedType enum*/ , System::Byte /*cli type*/); 512 | }; 513 | 514 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_ASSIGNED_OBJECT_ID : public SIMCONNECT_RECV // when dwID == SIMCONNECT_RECV_ID_ASSIGNED_OBJECT_ID 515 | { 516 | DWORD dwRequestID; 517 | DWORD dwObjectID; 518 | }; 519 | 520 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_RESERVED_KEY : public SIMCONNECT_RECV // when dwID == SIMCONNECT_RECV_ID_RESERVED_KEY 521 | { 522 | SIMCONNECT_STRING( szChoiceReserved, 30); 523 | SIMCONNECT_STRING( szReservedKey, 50); 524 | }; 525 | 526 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_SYSTEM_STATE : public SIMCONNECT_RECV // when dwID == SIMCONNECT_RECV_ID_SYSTEM_STATE 527 | { 528 | DWORD dwRequestID; 529 | DWORD dwInteger; 530 | float fFloat; 531 | SIMCONNECT_STRING( szString, MAX_PATH); 532 | }; 533 | 534 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_CUSTOM_ACTION : public SIMCONNECT_RECV_EVENT 535 | { 536 | SIMCONNECT_GUID guidInstanceId; // Instance id of the action that executed 537 | DWORD dwWaitForCompletion; // Wait for completion flag on the action 538 | SIMCONNECT_STRINGV( szPayLoad); // Variable length string payload associated with the mission action. 539 | }; 540 | 541 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_EVENT_WEATHER_MODE : public SIMCONNECT_RECV_EVENT 542 | { 543 | // No event specific data - the new weather mode is in the base structure dwData member. 544 | }; 545 | 546 | // SIMCONNECT_RECV_FACILITIES_LIST 547 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_FACILITIES_LIST : public SIMCONNECT_RECV 548 | { 549 | DWORD dwRequestID; 550 | DWORD dwArraySize; 551 | DWORD dwEntryNumber; // when the array of items is too big for one send, which send this is (0..dwOutOf-1) 552 | DWORD dwOutOf; // total number of transmissions the list is chopped into 553 | }; 554 | 555 | // SIMCONNECT_DATA_FACILITY_AIRPORT 556 | SIMCONNECT_REFSTRUCT SIMCONNECT_DATA_FACILITY_AIRPORT 557 | { 558 | SIMCONNECT_STRING(Icao, 9); // ICAO of the object 559 | double Latitude; // degrees 560 | double Longitude; // degrees 561 | double Altitude; // meters 562 | }; 563 | 564 | // SIMCONNECT_RECV_AIRPORT_LIST 565 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_AIRPORT_LIST : public SIMCONNECT_RECV_FACILITIES_LIST 566 | { 567 | SIMCONNECT_FIXEDTYPE_DATAV(SIMCONNECT_DATA_FACILITY_AIRPORT, rgData, dwArraySize, U1 /*member of UnmanagedType enum*/, SIMCONNECT_DATA_FACILITY_AIRPORT /*cli type*/); 568 | }; 569 | 570 | 571 | // SIMCONNECT_DATA_FACILITY_WAYPOINT 572 | SIMCONNECT_REFSTRUCT SIMCONNECT_DATA_FACILITY_WAYPOINT : public SIMCONNECT_DATA_FACILITY_AIRPORT 573 | { 574 | float fMagVar; // Magvar in degrees 575 | }; 576 | 577 | // SIMCONNECT_RECV_WAYPOINT_LIST 578 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_WAYPOINT_LIST : public SIMCONNECT_RECV_FACILITIES_LIST 579 | { 580 | SIMCONNECT_FIXEDTYPE_DATAV(SIMCONNECT_DATA_FACILITY_WAYPOINT, rgData, dwArraySize, U1 /*member of UnmanagedType enum*/, SIMCONNECT_DATA_FACILITY_WAYPOINT /*cli type*/); 581 | }; 582 | 583 | // SIMCONNECT_DATA_FACILITY_NDB 584 | SIMCONNECT_REFSTRUCT SIMCONNECT_DATA_FACILITY_NDB : public SIMCONNECT_DATA_FACILITY_WAYPOINT 585 | { 586 | DWORD fFrequency; // frequency in Hz 587 | }; 588 | 589 | // SIMCONNECT_RECV_NDB_LIST 590 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_NDB_LIST : public SIMCONNECT_RECV_FACILITIES_LIST 591 | { 592 | SIMCONNECT_FIXEDTYPE_DATAV(SIMCONNECT_DATA_FACILITY_NDB, rgData, dwArraySize, U1 /*member of UnmanagedType enum*/, SIMCONNECT_DATA_FACILITY_NDB /*cli type*/); 593 | }; 594 | 595 | // SIMCONNECT_DATA_FACILITY_VOR 596 | SIMCONNECT_REFSTRUCT SIMCONNECT_DATA_FACILITY_VOR : public SIMCONNECT_DATA_FACILITY_NDB 597 | { 598 | DWORD Flags; // SIMCONNECT_VOR_FLAGS 599 | float fLocalizer; // Localizer in degrees 600 | double GlideLat; // Glide Slope Location (deg, deg, meters) 601 | double GlideLon; 602 | double GlideAlt; 603 | float fGlideSlopeAngle; // Glide Slope in degrees 604 | }; 605 | 606 | // SIMCONNECT_RECV_VOR_LIST 607 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_VOR_LIST : public SIMCONNECT_RECV_FACILITIES_LIST 608 | { 609 | SIMCONNECT_FIXEDTYPE_DATAV(SIMCONNECT_DATA_FACILITY_VOR, rgData, dwArraySize, U1 /*member of UnmanagedType enum*/, SIMCONNECT_DATA_FACILITY_VOR /*cli type*/); 610 | }; 611 | 612 | #ifdef ENABLE_SIMCONNECT_EXPERIMENTAL 613 | 614 | SIMCONNECT_REFSTRUCT SIMCONNECT_RECV_PICK : public SIMCONNECT_RECV // when dwID == SIMCONNECT_RECV_ID_RESERVED_KEY 615 | { 616 | HANDLE hContext; 617 | DWORD dwFlags; // 618 | double Latitude; // degrees 619 | double Longitude; // degrees 620 | double Altitude; // feet 621 | int xPos; //reserved 622 | int yPos; //reserved; 623 | DWORD dwSimObjectID; 624 | HANDLE hSceneryObject; 625 | DWORD dwentrynumber; // if multiple objects returned, this is number out of . 626 | DWORD dwoutof; // note: starts with 1, not 0. 627 | }; 628 | 629 | #endif //ENABLE_SIMCONNECT_EXPERIMENTAL 630 | 631 | 632 | // SIMCONNECT_DATATYPE_INITPOSITION 633 | SIMCONNECT_STRUCT SIMCONNECT_DATA_INITPOSITION 634 | { 635 | double Latitude; // degrees 636 | double Longitude; // degrees 637 | double Altitude; // feet 638 | double Pitch; // degrees 639 | double Bank; // degrees 640 | double Heading; // degrees 641 | DWORD OnGround; // 1=force to be on the ground 642 | DWORD Airspeed; // knots 643 | }; 644 | 645 | 646 | // SIMCONNECT_DATATYPE_MARKERSTATE 647 | SIMCONNECT_STRUCT SIMCONNECT_DATA_MARKERSTATE 648 | { 649 | SIMCONNECT_STRING( szMarkerName, 64); 650 | DWORD dwMarkerState; 651 | }; 652 | 653 | // SIMCONNECT_DATATYPE_WAYPOINT 654 | SIMCONNECT_STRUCT SIMCONNECT_DATA_WAYPOINT 655 | { 656 | double Latitude; // degrees 657 | double Longitude; // degrees 658 | double Altitude; // feet 659 | unsigned long Flags; 660 | double ktsSpeed; // knots 661 | double percentThrottle; 662 | }; 663 | 664 | // SIMCONNECT_DATA_LATLONALT 665 | SIMCONNECT_STRUCT SIMCONNECT_DATA_LATLONALT 666 | { 667 | double Latitude; 668 | double Longitude; 669 | double Altitude; 670 | }; 671 | 672 | // SIMCONNECT_DATA_XYZ 673 | SIMCONNECT_STRUCT SIMCONNECT_DATA_XYZ 674 | { 675 | double x; 676 | double y; 677 | double z; 678 | }; 679 | 680 | #pragma pack(pop) 681 | 682 | //---------------------------------------------------------------------------- 683 | // End of Struct definitions 684 | //---------------------------------------------------------------------------- 685 | 686 | typedef void (CALLBACK *DispatchProc)(SIMCONNECT_RECV* pData, DWORD cbData, void* pContext); 687 | 688 | #if !defined(SIMCONNECTAPI) 689 | #ifdef _MSFS_WASM 690 | #ifdef __INTELLISENSE__ 691 | #define MODULE_EXPORT 692 | #define SIMCONNECTAPI extern "C" HRESULT 693 | #else 694 | #define MODULE_EXPORT __attribute__( ( visibility( "default" ) ) ) 695 | #define SIMCONNECTAPI extern "C" __attribute__((import_module(SIMCONNECT_WASM_MODULE))) HRESULT 696 | #endif 697 | #else 698 | #define MODULE_EXPORT 699 | #define SIMCONNECTAPI extern "C" HRESULT __stdcall 700 | #endif 701 | #endif 702 | 703 | SIMCONNECTAPI SimConnect_MapClientEventToSimEvent(HANDLE hSimConnect, SIMCONNECT_CLIENT_EVENT_ID EventID, const char * EventName = ""); 704 | SIMCONNECTAPI SimConnect_TransmitClientEvent(HANDLE hSimConnect, SIMCONNECT_OBJECT_ID ObjectID, SIMCONNECT_CLIENT_EVENT_ID EventID, DWORD dwData, SIMCONNECT_NOTIFICATION_GROUP_ID GroupID, SIMCONNECT_EVENT_FLAG Flags); 705 | SIMCONNECTAPI SimConnect_SetSystemEventState(HANDLE hSimConnect, SIMCONNECT_CLIENT_EVENT_ID EventID, SIMCONNECT_STATE dwState); 706 | SIMCONNECTAPI SimConnect_AddClientEventToNotificationGroup(HANDLE hSimConnect, SIMCONNECT_NOTIFICATION_GROUP_ID GroupID, SIMCONNECT_CLIENT_EVENT_ID EventID, BOOL bMaskable = FALSE); 707 | SIMCONNECTAPI SimConnect_RemoveClientEvent(HANDLE hSimConnect, SIMCONNECT_NOTIFICATION_GROUP_ID GroupID, SIMCONNECT_CLIENT_EVENT_ID EventID); 708 | SIMCONNECTAPI SimConnect_SetNotificationGroupPriority(HANDLE hSimConnect, SIMCONNECT_NOTIFICATION_GROUP_ID GroupID, DWORD uPriority); 709 | SIMCONNECTAPI SimConnect_ClearNotificationGroup(HANDLE hSimConnect, SIMCONNECT_NOTIFICATION_GROUP_ID GroupID); 710 | SIMCONNECTAPI SimConnect_RequestNotificationGroup(HANDLE hSimConnect, SIMCONNECT_NOTIFICATION_GROUP_ID GroupID, DWORD dwReserved = 0, DWORD Flags = 0); 711 | SIMCONNECTAPI SimConnect_AddToDataDefinition(HANDLE hSimConnect, SIMCONNECT_DATA_DEFINITION_ID DefineID, const char * DatumName, const char * UnitsName, SIMCONNECT_DATATYPE DatumType = SIMCONNECT_DATATYPE_FLOAT64, float fEpsilon = 0, DWORD DatumID = SIMCONNECT_UNUSED); 712 | SIMCONNECTAPI SimConnect_ClearDataDefinition(HANDLE hSimConnect, SIMCONNECT_DATA_DEFINITION_ID DefineID); 713 | SIMCONNECTAPI SimConnect_RequestDataOnSimObject(HANDLE hSimConnect, SIMCONNECT_DATA_REQUEST_ID RequestID, SIMCONNECT_DATA_DEFINITION_ID DefineID, SIMCONNECT_OBJECT_ID ObjectID, SIMCONNECT_PERIOD Period, SIMCONNECT_DATA_REQUEST_FLAG Flags = 0, DWORD origin = 0, DWORD interval = 0, DWORD limit = 0); 714 | SIMCONNECTAPI SimConnect_RequestDataOnSimObjectType(HANDLE hSimConnect, SIMCONNECT_DATA_REQUEST_ID RequestID, SIMCONNECT_DATA_DEFINITION_ID DefineID, DWORD dwRadiusMeters, SIMCONNECT_SIMOBJECT_TYPE type); 715 | SIMCONNECTAPI SimConnect_SetDataOnSimObject(HANDLE hSimConnect, SIMCONNECT_DATA_DEFINITION_ID DefineID, SIMCONNECT_OBJECT_ID ObjectID, SIMCONNECT_DATA_SET_FLAG Flags, DWORD ArrayCount, DWORD cbUnitSize, void * pDataSet); 716 | SIMCONNECTAPI SimConnect_MapInputEventToClientEvent(HANDLE hSimConnect, SIMCONNECT_INPUT_GROUP_ID GroupID, const char * szInputDefinition, SIMCONNECT_CLIENT_EVENT_ID DownEventID, DWORD DownValue = 0, SIMCONNECT_CLIENT_EVENT_ID UpEventID = (SIMCONNECT_CLIENT_EVENT_ID)SIMCONNECT_UNUSED, DWORD UpValue = 0, BOOL bMaskable = FALSE); 717 | SIMCONNECTAPI SimConnect_SetInputGroupPriority(HANDLE hSimConnect, SIMCONNECT_INPUT_GROUP_ID GroupID, DWORD uPriority); 718 | SIMCONNECTAPI SimConnect_RemoveInputEvent(HANDLE hSimConnect, SIMCONNECT_INPUT_GROUP_ID GroupID, const char * szInputDefinition); 719 | SIMCONNECTAPI SimConnect_ClearInputGroup(HANDLE hSimConnect, SIMCONNECT_INPUT_GROUP_ID GroupID); 720 | SIMCONNECTAPI SimConnect_SetInputGroupState(HANDLE hSimConnect, SIMCONNECT_INPUT_GROUP_ID GroupID, DWORD dwState); 721 | SIMCONNECTAPI SimConnect_RequestReservedKey(HANDLE hSimConnect, SIMCONNECT_CLIENT_EVENT_ID EventID, const char * szKeyChoice1 = "", const char * szKeyChoice2 = "", const char * szKeyChoice3 = ""); 722 | SIMCONNECTAPI SimConnect_SubscribeToSystemEvent(HANDLE hSimConnect, SIMCONNECT_CLIENT_EVENT_ID EventID, const char * SystemEventName); 723 | SIMCONNECTAPI SimConnect_UnsubscribeFromSystemEvent(HANDLE hSimConnect, SIMCONNECT_CLIENT_EVENT_ID EventID); 724 | SIMCONNECTAPI SimConnect_WeatherRequestInterpolatedObservation(HANDLE hSimConnect, SIMCONNECT_DATA_REQUEST_ID RequestID, float lat, float lon, float alt); 725 | SIMCONNECTAPI SimConnect_WeatherRequestObservationAtStation(HANDLE hSimConnect, SIMCONNECT_DATA_REQUEST_ID RequestID, const char * szICAO); 726 | SIMCONNECTAPI SimConnect_WeatherRequestObservationAtNearestStation(HANDLE hSimConnect, SIMCONNECT_DATA_REQUEST_ID RequestID, float lat, float lon); 727 | SIMCONNECTAPI SimConnect_WeatherCreateStation(HANDLE hSimConnect, SIMCONNECT_DATA_REQUEST_ID RequestID, const char * szICAO, const char * szName, float lat, float lon, float alt); 728 | SIMCONNECTAPI SimConnect_WeatherRemoveStation(HANDLE hSimConnect, SIMCONNECT_DATA_REQUEST_ID RequestID, const char * szICAO); 729 | SIMCONNECTAPI SimConnect_WeatherSetObservation(HANDLE hSimConnect, DWORD Seconds, const char * szMETAR); 730 | SIMCONNECTAPI SimConnect_WeatherSetModeServer(HANDLE hSimConnect, DWORD dwPort, DWORD dwSeconds); 731 | SIMCONNECTAPI SimConnect_WeatherSetModeTheme(HANDLE hSimConnect, const char * szThemeName); 732 | SIMCONNECTAPI SimConnect_WeatherSetModeGlobal(HANDLE hSimConnect); 733 | SIMCONNECTAPI SimConnect_WeatherSetModeCustom(HANDLE hSimConnect); 734 | SIMCONNECTAPI SimConnect_WeatherSetDynamicUpdateRate(HANDLE hSimConnect, DWORD dwRate); 735 | SIMCONNECTAPI SimConnect_WeatherRequestCloudState(HANDLE hSimConnect, SIMCONNECT_DATA_REQUEST_ID RequestID, float minLat, float minLon, float minAlt, float maxLat, float maxLon, float maxAlt, DWORD dwFlags = 0); 736 | SIMCONNECTAPI SimConnect_WeatherCreateThermal(HANDLE hSimConnect, SIMCONNECT_DATA_REQUEST_ID RequestID, float lat, float lon, float alt, float radius, float height, float coreRate = 3.0f, float coreTurbulence = 0.05f, float sinkRate = 3.0f, float sinkTurbulence = 0.2f, float coreSize = 0.4f, float coreTransitionSize = 0.1f, float sinkLayerSize = 0.4f, float sinkTransitionSize = 0.1f); 737 | SIMCONNECTAPI SimConnect_WeatherRemoveThermal(HANDLE hSimConnect, SIMCONNECT_OBJECT_ID ObjectID); 738 | SIMCONNECTAPI SimConnect_AICreateParkedATCAircraft(HANDLE hSimConnect, const char * szContainerTitle, const char * szTailNumber, const char * szAirportID, SIMCONNECT_DATA_REQUEST_ID RequestID); 739 | SIMCONNECTAPI SimConnect_AICreateEnrouteATCAircraft(HANDLE hSimConnect, const char * szContainerTitle, const char * szTailNumber, int iFlightNumber, const char * szFlightPlanPath, double dFlightPlanPosition, BOOL bTouchAndGo, SIMCONNECT_DATA_REQUEST_ID RequestID); 740 | SIMCONNECTAPI SimConnect_AICreateNonATCAircraft(HANDLE hSimConnect, const char * szContainerTitle, const char * szTailNumber, SIMCONNECT_DATA_INITPOSITION InitPos, SIMCONNECT_DATA_REQUEST_ID RequestID); 741 | SIMCONNECTAPI SimConnect_AICreateSimulatedObject(HANDLE hSimConnect, const char * szContainerTitle, SIMCONNECT_DATA_INITPOSITION InitPos, SIMCONNECT_DATA_REQUEST_ID RequestID); 742 | SIMCONNECTAPI SimConnect_AIReleaseControl(HANDLE hSimConnect, SIMCONNECT_OBJECT_ID ObjectID, SIMCONNECT_DATA_REQUEST_ID RequestID); 743 | SIMCONNECTAPI SimConnect_AIRemoveObject(HANDLE hSimConnect, SIMCONNECT_OBJECT_ID ObjectID, SIMCONNECT_DATA_REQUEST_ID RequestID); 744 | SIMCONNECTAPI SimConnect_AISetAircraftFlightPlan(HANDLE hSimConnect, SIMCONNECT_OBJECT_ID ObjectID, const char * szFlightPlanPath, SIMCONNECT_DATA_REQUEST_ID RequestID); 745 | SIMCONNECTAPI SimConnect_ExecuteMissionAction(HANDLE hSimConnect, const GUID guidInstanceId); 746 | SIMCONNECTAPI SimConnect_CompleteCustomMissionAction(HANDLE hSimConnect, const GUID guidInstanceId); 747 | SIMCONNECTAPI SimConnect_Close(HANDLE hSimConnect); 748 | SIMCONNECTAPI SimConnect_RetrieveString(SIMCONNECT_RECV * pData, DWORD cbData, void * pStringV, char ** pszString, DWORD * pcbString); 749 | SIMCONNECTAPI SimConnect_GetLastSentPacketID(HANDLE hSimConnect, DWORD * pdwError); 750 | SIMCONNECTAPI SimConnect_Open(HANDLE * phSimConnect, LPCSTR szName, HWND hWnd, DWORD UserEventWin32, HANDLE hEventHandle, DWORD ConfigIndex); 751 | SIMCONNECTAPI SimConnect_CallDispatch(HANDLE hSimConnect, DispatchProc pfcnDispatch, void * pContext); 752 | SIMCONNECTAPI SimConnect_GetNextDispatch(HANDLE hSimConnect, SIMCONNECT_RECV ** ppData, DWORD * pcbData); 753 | SIMCONNECTAPI SimConnect_RequestResponseTimes(HANDLE hSimConnect, DWORD nCount, float * fElapsedSeconds); 754 | SIMCONNECTAPI SimConnect_InsertString(char * pDest, DWORD cbDest, void ** ppEnd, DWORD * pcbStringV, const char * pSource); 755 | SIMCONNECTAPI SimConnect_CameraSetRelative6DOF(HANDLE hSimConnect, float fDeltaX, float fDeltaY, float fDeltaZ, float fPitchDeg, float fBankDeg, float fHeadingDeg); 756 | SIMCONNECTAPI SimConnect_MenuAddItem(HANDLE hSimConnect, const char * szMenuItem, SIMCONNECT_CLIENT_EVENT_ID MenuEventID, DWORD dwData); 757 | SIMCONNECTAPI SimConnect_MenuDeleteItem(HANDLE hSimConnect, SIMCONNECT_CLIENT_EVENT_ID MenuEventID); 758 | SIMCONNECTAPI SimConnect_MenuAddSubItem(HANDLE hSimConnect, SIMCONNECT_CLIENT_EVENT_ID MenuEventID, const char * szMenuItem, SIMCONNECT_CLIENT_EVENT_ID SubMenuEventID, DWORD dwData); 759 | SIMCONNECTAPI SimConnect_MenuDeleteSubItem(HANDLE hSimConnect, SIMCONNECT_CLIENT_EVENT_ID MenuEventID, const SIMCONNECT_CLIENT_EVENT_ID SubMenuEventID); 760 | SIMCONNECTAPI SimConnect_RequestSystemState(HANDLE hSimConnect, SIMCONNECT_DATA_REQUEST_ID RequestID, const char * szState); 761 | SIMCONNECTAPI SimConnect_SetSystemState(HANDLE hSimConnect, const char * szState, DWORD dwInteger, float fFloat, const char * szString); 762 | SIMCONNECTAPI SimConnect_MapClientDataNameToID(HANDLE hSimConnect, const char * szClientDataName, SIMCONNECT_CLIENT_DATA_ID ClientDataID); 763 | SIMCONNECTAPI SimConnect_CreateClientData(HANDLE hSimConnect, SIMCONNECT_CLIENT_DATA_ID ClientDataID, DWORD dwSize, SIMCONNECT_CREATE_CLIENT_DATA_FLAG Flags); 764 | SIMCONNECTAPI SimConnect_AddToClientDataDefinition(HANDLE hSimConnect, SIMCONNECT_CLIENT_DATA_DEFINITION_ID DefineID, DWORD dwOffset, DWORD dwSizeOrType, float fEpsilon = 0, DWORD DatumID = SIMCONNECT_UNUSED); 765 | SIMCONNECTAPI SimConnect_ClearClientDataDefinition(HANDLE hSimConnect, SIMCONNECT_CLIENT_DATA_DEFINITION_ID DefineID); 766 | SIMCONNECTAPI SimConnect_RequestClientData(HANDLE hSimConnect, SIMCONNECT_CLIENT_DATA_ID ClientDataID, SIMCONNECT_DATA_REQUEST_ID RequestID, SIMCONNECT_CLIENT_DATA_DEFINITION_ID DefineID, SIMCONNECT_CLIENT_DATA_PERIOD Period = SIMCONNECT_CLIENT_DATA_PERIOD_ONCE, SIMCONNECT_CLIENT_DATA_REQUEST_FLAG Flags = 0, DWORD origin = 0, DWORD interval = 0, DWORD limit = 0); 767 | SIMCONNECTAPI SimConnect_SetClientData(HANDLE hSimConnect, SIMCONNECT_CLIENT_DATA_ID ClientDataID, SIMCONNECT_CLIENT_DATA_DEFINITION_ID DefineID, SIMCONNECT_CLIENT_DATA_SET_FLAG Flags, DWORD dwReserved, DWORD cbUnitSize, void * pDataSet); 768 | SIMCONNECTAPI SimConnect_FlightLoad(HANDLE hSimConnect, const char * szFileName); 769 | SIMCONNECTAPI SimConnect_FlightSave(HANDLE hSimConnect, const char * szFileName, const char * szTitle, const char * szDescription, DWORD Flags); 770 | SIMCONNECTAPI SimConnect_FlightPlanLoad(HANDLE hSimConnect, const char * szFileName); 771 | SIMCONNECTAPI SimConnect_Text(HANDLE hSimConnect, SIMCONNECT_TEXT_TYPE type, float fTimeSeconds, SIMCONNECT_CLIENT_EVENT_ID EventID, DWORD cbUnitSize, void * pDataSet); 772 | SIMCONNECTAPI SimConnect_SubscribeToFacilities(HANDLE hSimConnect, SIMCONNECT_FACILITY_LIST_TYPE type, SIMCONNECT_DATA_REQUEST_ID RequestID); 773 | SIMCONNECTAPI SimConnect_UnsubscribeToFacilities(HANDLE hSimConnect, SIMCONNECT_FACILITY_LIST_TYPE type); 774 | SIMCONNECTAPI SimConnect_RequestFacilitiesList(HANDLE hSimConnect, SIMCONNECT_FACILITY_LIST_TYPE type, SIMCONNECT_DATA_REQUEST_ID RequestID); 775 | 776 | #endif // _SIMCONNECT_H_ 777 | -------------------------------------------------------------------------------- /references/simvars.txt: -------------------------------------------------------------------------------- 1 | # Nicked from /MSFS SDK/Samples/SimvarWatcher/textsimvars.cs 2 | 3 | NONE 4 | ANGLE OF ATTACK INDICATOR 5 | GUN AMMO 6 | CANNON AMMO 7 | ROCKET AMMO 8 | BOMB AMMO 9 | LIGHT ON STATES 10 | LIGHT STATES 11 | LIGHT PANEL 12 | LIGHT STROBE 13 | LIGHT LANDING 14 | STROBE FLASH 15 | LIGHT TAXI 16 | LIGHT BEACON 17 | LIGHT NAV 18 | LIGHT LOGO 19 | LIGHT WING 20 | LIGHT RECOGNITION 21 | LIGHT CABIN 22 | LANDING LIGHT PBH 23 | LIGHT NAV ON 24 | LIGHT BEACON ON 25 | LIGHT LANDING ON 26 | LIGHT TAXI ON 27 | LIGHT STROBE ON 28 | LIGHT PANEL ON 29 | LIGHT RECOGNITION ON 30 | LIGHT WING ON 31 | LIGHT LOGO ON 32 | LIGHT CABIN ON 33 | LIGHT HEAD ON 34 | LIGHT BRAKE ON 35 | WHEEL RPM 36 | CENTER WHEEL RPM 37 | LEFT WHEEL RPM 38 | RIGHT WHEEL RPM 39 | AUX WHEEL RPM 40 | WHEEL ROTATION ANGLE 41 | CENTER WHEEL ROTATION ANGLE 42 | LEFT WHEEL ROTATION ANGLE 43 | RIGHT WHEEL ROTATION ANGLE 44 | AUX WHEEL ROTATION ANGLE 45 | SIGMA SQRT 46 | DYNAMIC PRESSURE 47 | TOTAL VELOCITY 48 | TOTAL WORLD VELOCITY 49 | GROUND VELOCITY 50 | SURFACE RELATIVE GROUND SPEED 51 | AIRSPEED TRUE 52 | AIRSPEED INDICATED 53 | AIRSPEED SELECT INDICATED OR TRUE 54 | AIRSPEED TRUE CALIBRATE 55 | AIRSPEED BARBER POLE 56 | AIRSPEED MACH 57 | VERTICAL SPEED 58 | VARIOMETER RATE 59 | VARIOMETER SWITCH 60 | MACH MAX OPERATE 61 | STALL WARNING 62 | OVERSPEED WARNING 63 | BARBER POLE MACH 64 | VELOCITY BODY X 65 | VELOCITY BODY Y 66 | VELOCITY BODY Z 67 | VELOCITY WORLD X 68 | VELOCITY WORLD Y 69 | VELOCITY WORLD Z 70 | RELATIVE WIND VELOCITY BODY X 71 | RELATIVE WIND VELOCITY BODY Y 72 | RELATIVE WIND VELOCITY BODY Z 73 | ACCELERATION WORLD X 74 | ACCELERATION WORLD Y 75 | ACCELERATION WORLD Z 76 | ACCELERATION BODY X 77 | ACCELERATION BODY Y 78 | ACCELERATION BODY Z 79 | ROTATION VELOCITY BODY X 80 | ROTATION VELOCITY BODY Y 81 | ROTATION VELOCITY BODY Z 82 | DESIGN SPEED VS0 83 | DESIGN SPEED VS1 84 | DESIGN SPEED VC 85 | DESIGN SPEED MIN ROTATION 86 | DESIGN SPEED CLIMB 87 | DESIGN CRUISE ALT 88 | DESIGN TAKEOFF SPEED 89 | AI CONTROLS 90 | DELEGATE CONTROLS TO AI 91 | MIN DRAG VELOCITY 92 | PLANE LATITUDE 93 | PLANE LONGITUDE 94 | PLANE ALTITUDE 95 | PLANE ALT ABOVE GROUND 96 | PLANE PITCH DEGREES 97 | PLANE BANK DEGREES 98 | PLANE HEADING DEGREES MAGNETIC 99 | PLANE HEADING DEGREES TRUE 100 | INDICATED ALTITUDE 101 | PRESSURE ALTITUDE 102 | KOHLSMAN SETTING MB 103 | KOHLSMAN SETTING HG 104 | ATTITUDE INDICATOR PITCH DEGREES 105 | ATTITUDE INDICATOR BANK DEGREES 106 | ATTITUDE BARS POSITION 107 | ATTITUDE CAGE 108 | MAGVAR 109 | WISKEY COMPASS INDICATION DEGREES 110 | MAGNETIC COMPASS 111 | PLANE HEADING DEGREES GYRO 112 | GYRO DRIFT ERROR 113 | DELTA HEADING RATE 114 | TURN INDICATOR RATE 115 | TURN INDICATOR SWITCH 116 | GROUND ALTITUDE 117 | SIM ON GROUND 118 | SIM SHOULD SET ON GROUND 119 | TURN COORDINATOR BALL 120 | YOKE Y POSITION 121 | YOKE Y INDICATOR 122 | YOKE X POSITION 123 | YOKE X INIDICATOR 124 | YOKE X INDICATOR 125 | AILERON POSITION 126 | RUDDER PEDAL POSITION 127 | RUDDER PEDAL INDICATOR 128 | RUDDER POSITION 129 | ELEVATOR POSITION 130 | ELEVATOR TRIM POSITION 131 | ELEVATOR TRIM INDICATOR 132 | ELEVATOR TRIM PCT 133 | BRAKE LEFT POSITION 134 | BRAKE RIGHT POSITION 135 | BRAKE INDICATOR 136 | BRAKE PARKING POSITION 137 | BRAKE PARKING INDICATOR 138 | BRAKE DEPENDENT HYDRAULIC PRESSURE 139 | SPOILERS ARMED 140 | SPOILERS HANDLE POSITION 141 | SPOILERS LEFT POSITION 142 | SPOILERS RIGHT POSITION 143 | FLY BY WIRE ELAC SWITCH 144 | FLY BY WIRE FAC SWITCH 145 | FLY BY WIRE SEC SWITCH 146 | FLY BY WIRE ELAC FAILED 147 | FLY BY WIRE FAC FAILED 148 | FLY BY WIRE SEC FAILED 149 | FLY BY WIRE ALPHA PROTECTION 150 | FLAPS NUM HANDLE POSITIONS 151 | FLAPS HANDLE PERCENT 152 | FLAPS HANDLE INDEX 153 | TRAILING EDGE FLAPS LEFT PERCENT 154 | TRAILING EDGE FLAPS RIGHT PERCENT 155 | LEADING EDGE FLAPS LEFT PERCENT 156 | LEADING EDGE FLAPS RIGHT PERCENT 157 | TRAILING EDGE FLAPS LEFT ANGLE 158 | TRAILING EDGE FLAPS RIGHT ANGLE 159 | LEADING EDGE FLAPS LEFT ANGLE 160 | LEADING EDGE FLAPS RIGHT ANGLE 161 | FLAP POSITION SET 162 | IS GEAR RETRACTABLE 163 | IS GEAR WHEELS 164 | IS GEAR SKIS 165 | IS GEAR FLOATS 166 | IS GEAR SKIDS 167 | GEAR HANDLE POSITION 168 | GEAR EMERGENCY HANDLE POSITION 169 | GEAR CENTER POSITION 170 | GEAR LEFT POSITION 171 | GEAR RIGHT POSITION 172 | GEAR TAIL POSITION 173 | GEAR AUX POSITION 174 | GEAR POSITION 175 | GEAR ANIMATION POSITION 176 | GEAR TOTAL PCT EXTENDED 177 | GEAR WARNING 178 | TAILWHEEL LOCK ON 179 | NOSEWHEEL LOCK ON 180 | COWL FLAPS 181 | AVIONICS MASTER SWITCH 182 | PANEL AUTO FEATHER SWITCH 183 | PANEL ANTI ICE SWITCH 184 | AUTO BRAKE SWITCH CB 185 | ANTISKID BRAKES ACTIVE 186 | WATER RUDDER HANDLE POSITION 187 | WATER LEFT RUDDER EXTENDED 188 | WATER RIGHT RUDDER EXTENDED 189 | RETRACT FLOAT SWITCH 190 | RETRACT LEFT FLOAT EXTENDED 191 | RETRACT RIGHT FLOAT EXTENDED 192 | GEAR CENTER STEER ANGLE 193 | GEAR LEFT STEER ANGLE 194 | GEAR RIGHT STEER ANGLE 195 | GEAR AUX STEER ANGLE 196 | GEAR STEER ANGLE 197 | WATER LEFT RUDDER STEER ANGLE 198 | WATER RIGHT RUDDER STEER ANGLE 199 | GEAR CENTER STEER ANGLE PCT 200 | GEAR LEFT STEER ANGLE PCT 201 | GEAR RIGHT STEER ANGLE PCT 202 | GEAR AUX STEER ANGLE PCT 203 | GEAR STEER ANGLE PCT 204 | WATER LEFT RUDDER STEER ANGLE PCT 205 | WATER RIGHT RUDDER STEER ANGLE PCT 206 | STEER INPUT CONTROL 207 | ELEVATOR DEFLECTION 208 | ELEVATOR DEFLECTION PCT 209 | AILERON LEFT DEFLECTION 210 | AILERON LEFT DEFLECTION PCT 211 | AILERON RIGHT DEFLECTION 212 | AILERON RIGHT DEFLECTION PCT 213 | AILERON AVERAGE DEFLECTION 214 | AILERON TRIM 215 | AILERON TRIM PCT 216 | RUDDER DEFLECTION 217 | RUDDER DEFLECTION PCT 218 | RUDDER TRIM 219 | RUDDER TRIM PCT 220 | WING FLEX PCT 221 | WING AREA 222 | WING SPAN 223 | PROP SYNC ACTIVE 224 | INCIDENCE ALPHA 225 | INCIDENCE BETA 226 | BETA DOT 227 | LINEAR CL ALPHA 228 | STALL ALPHA 229 | ZERO LIFT ALPHA 230 | CG PERCENT 231 | CG PERCENT LATERAL 232 | CG AFT LIMIT 233 | CG FWD LIMIT 234 | CG MAX MACH 235 | CG MIN MACH 236 | PAYLOAD STATION WEIGHT 237 | PAYLOAD STATION NAME 238 | PAYLOAD STATION COUNT 239 | PAYLOAD STATION OBJECT 240 | PAYLOAD STATION NUM SIMOBJECTS 241 | ELEVON DEFLECTION 242 | FOLDING WING LEFT PERCENT 243 | FOLDING WING RIGHT PERCENT 244 | FOLDING WING HANDLE POSITION 245 | CANOPY OPEN 246 | TAILHOOK POSITION 247 | TAILHOOK HANDLE 248 | LAUNCHBAR POSITION 249 | LAUNCHBAR SWITCH 250 | LAUNCHBAR HELD EXTENDED 251 | EXIT OPEN 252 | EXIT TYPE 253 | EXIT POSX 254 | EXIT POSY 255 | EXIT POSZ 256 | RADIO HEIGHT 257 | DECISION HEIGHT 258 | DECISION ALTITUDE MSL 259 | TOTAL WEIGHT 260 | MAX GROSS WEIGHT 261 | EMPTY WEIGHT 262 | EMPTY WEIGHT PITCH MOI 263 | EMPTY WEIGHT ROLL MOI 264 | EMPTY WEIGHT YAW MOI 265 | EMPTY WEIGHT CROSS COUPLED MOI 266 | TOTAL WEIGHT PITCH MOI 267 | TOTAL WEIGHT ROLL MOI 268 | TOTAL WEIGHT YAW MOI 269 | TOTAL WEIGHT CROSS COUPLED MOI 270 | WATER BALLAST VALVE 271 | AUTOPILOT MASTER 272 | AUTOPILOT WING LEVELER 273 | AUTOPILOT NAV1 LOCK 274 | AUTOPILOT HEADING LOCK 275 | AUTOPILOT HEADING LOCK DIR 276 | AUTOPILOT ALTITUDE LOCK 277 | AUTOPILOT ALTITUDE LOCK VAR 278 | AUTOPILOT ATTITUDE HOLD 279 | AUTOPILOT GLIDESLOPE HOLD 280 | AUTOPILOT APPROACH HOLD 281 | AUTOPILOT BACKCOURSE HOLD 282 | AUTOPILOT YAW DAMPER 283 | AUTOPILOT AIRSPEED HOLD 284 | AUTOPILOT AIRSPEED HOLD VAR 285 | AUTOPILOT MACH HOLD 286 | AUTOPILOT MACH HOLD VAR 287 | AUTOPILOT VERTICAL HOLD 288 | AUTOPILOT VERTICAL HOLD VAR 289 | AUTOPILOT ALTITUDE MANUALLY TUNABLE 290 | AUTOPILOT HEADING MANUALLY TUNABLE 291 | AUTOPILOT THROTTLE ARM 292 | AUTOPILOT TAKEOFF POWER ACTIVE 293 | AUTOPILOT RPM HOLD 294 | AUTOPILOT RPM HOLD VAR 295 | AUTOPILOT SPEED SETTING 296 | AUTOPILOT AIRSPEED ACQUISITION 297 | AUTOPILOT AIRSPEED HOLD CURRENT 298 | AUTOPILOT MAX SPEED HOLD 299 | AUTOPILOT CRUISE SPEED HOLD 300 | AUTOPILOT FLIGHT DIRECTOR ACTIVE 301 | AUTOPILOT FLIGHT DIRECTOR PITCH 302 | AUTOPILOT FLIGHT DIRECTOR BANK 303 | AUTOPILOT PITCH HOLD 304 | AUTOPILOT PITCH HOLD REF 305 | AUTOPILOT NAV SELECTED 306 | GPS DRIVES NAV1 307 | AUTOTHROTTLE ACTIVE 308 | AUTOPILOT MAX BANK 309 | NUMBER OF CATAPULTS 310 | HOLDBACK BAR INSTALLED 311 | BLAST SHIELD POSITION 312 | CATAPULT STROKE POSITION 313 | ENGINE CONTROL SELECT 314 | NUMBER OF ENGINES 315 | MAX RATED ENGINE RPM 316 | PROPELLER ADVANCED SELECTION 317 | THROTTLE LOWER LIMIT 318 | OIL AMOUNT 319 | ENGINE PRIMER 320 | ENGINE TYPE 321 | ENG RPM ANIMATION PERCENT 322 | FULL THROTTLE THRUST TO WEIGHT RATIO 323 | PROP RPM 324 | PROP MAX RPM PERCENT 325 | PROP THRUST 326 | PROP BETA 327 | PROP FEATHERING INHIBIT 328 | PROP FEATHERED 329 | PROP SYNC DELTA LEVER 330 | PROP AUTO FEATHER ARMED 331 | PROP FEATHER SWITCH 332 | PROP AUTO CRUISE ACTIVE 333 | PROP ROTATION ANGLE 334 | PROP BETA MAX 335 | PROP BETA MIN 336 | PROP BETA MIN REVERSE 337 | MASTER IGNITION SWITCH 338 | ENG COMBUSTION 339 | OLD ENG STARTER 340 | ENG N1 RPM 341 | ENG N2 RPM 342 | ENG FUEL FLOW GPH 343 | ENG FUEL FLOW PPH 344 | ENG FUEL FLOW PPH SSL 345 | ENG TORQUE 346 | ENG ANTI ICE 347 | ENG PRESSURE RATIO 348 | ENG PRESSURE RATIO GES 349 | ENG EXHAUST GAS TEMPERATURE 350 | ENG EXHAUST GAS TEMPERATURE GES 351 | ENG CYLINDER HEAD TEMPERATURE 352 | ENG OIL TEMPERATURE 353 | ENG OIL PRESSURE 354 | ENG OIL QUANTITY 355 | ENG HYDRAULIC PRESSURE 356 | ENG HYDRAULIC QUANTITY 357 | ENG MANIFOLD PRESSURE 358 | ENG VIBRATION 359 | ENG RPM SCALER 360 | ENG TURBINE TEMPERATURE 361 | ENG TORQUE PERCENT 362 | ENG FUEL PRESSURE 363 | ENG ELECTRICAL LOAD 364 | ENG TRANSMISSION PRESSURE 365 | ENG TRANSMISSION TEMPERATURE 366 | ENG ROTOR RPM 367 | ENG FUEL FLOW BUG POSITION 368 | ENG MAX RPM 369 | ENG ON FIRE 370 | GENERAL ENG COMBUSTION 371 | GENERAL ENG MASTER ALTERNATOR 372 | GENERAL ENG FUEL PUMP SWITCH 373 | GENERAL ENG FUEL PUMP ON 374 | GENERAL ENG RPM 375 | GENERAL ENG PCT MAX RPM 376 | GENERAL ENG MAX REACHED RPM 377 | GENERAL ENG THROTTLE LEVER POSITION 378 | GENERAL ENG MIXTURE LEVER POSITION 379 | GENERAL ENG PROPELLER LEVER POSITION 380 | GENERAL ENG STARTER 381 | GENERAL ENG STARTER ACTIVE 382 | GENERAL ENG EXHAUST GAS TEMPERATURE 383 | GENERAL ENG OIL PRESSURE 384 | GENERAL ENG OIL LEAKED PERCENT 385 | GENERAL ENG COMBUSTION SOUND PERCENT 386 | GENERAL ENG DAMAGE PERCENT 387 | GENERAL ENG OIL TEMPERATURE 388 | GENERAL ENG FAILED 389 | GENERAL ENG GENERATOR SWITCH 390 | GENERAL ENG GENERATOR ACTIVE 391 | GENERAL ENG ANTI ICE POSITION 392 | GENERAL ENG FUEL VALVE 393 | GENERAL ENG FUEL PRESSURE 394 | GENERAL ENG ELAPSED TIME 395 | GENERAL ENG FIRE DETECTED 396 | GENERAL ENG FUEL USED SINCE START 397 | RECIP ENG COWL FLAP POSITION 398 | RECIP ENG PRIMER 399 | RECIP ENG MANIFOLD PRESSURE 400 | RECIP ENG ALTERNATE AIR POSITION 401 | RECIP ENG COOLANT RESERVOIR PERCENT 402 | RECIP ENG LEFT MAGNETO 403 | RECIP ENG RIGHT MAGNETO 404 | RECIP ENG BRAKE POWER 405 | RECIP ENG STARTER TORQUE 406 | RECIP ENG TURBOCHARGER FAILED 407 | RECIP ENG EMERGENCY BOOST ACTIVE 408 | RECIP ENG EMERGENCY BOOST ELAPSED TIME 409 | RECIP ENG WASTEGATE POSITION 410 | RECIP ENG TURBINE INLET TEMPERATURE 411 | RECIP ENG CYLINDER HEAD TEMPERATURE 412 | RECIP ENG RADIATOR TEMPERATURE 413 | RECIP ENG FUEL AVAILABLE 414 | RECIP ENG FUEL FLOW 415 | RECIP ENG FUEL TANK SELECTOR 416 | RECIP ENG FUEL TANKS USED 417 | RECIP ENG FUEL NUMBER TANKS USED 418 | RECIP ENG DETONATING 419 | RECIP ENG CYLINDER HEALTH 420 | RECIP ENG NUM CYLINDERS 421 | RECIP ENG NUM CYLINDERS FAILED 422 | RECIP CARBURETOR TEMPERATURE 423 | RECIP MIXTURE RATIO 424 | RECIP ENG ANTIDETONATION TANK VALVE 425 | RECIP ENG ANTIDETONATION TANK QUANTITY 426 | RECIP ENG ANTIDETONATION TANK MAX QUANTITY 427 | RECIP ENG NITROUS TANK VALVE 428 | RECIP ENG NITROUS TANK QUANTITY 429 | RECIP ENG NITROUS TANK MAX QUANTITY 430 | TURB ENG N1 431 | TURB ENG N2 432 | TURB ENG CORRECTED N1 433 | TURB ENG CORRECTED N2 434 | TURB ENG CORRECTED FF 435 | TURB ENG MAX TORQUE PERCENT 436 | TURB ENG PRESSURE RATIO 437 | TURB ENG ITT 438 | TURB ENG AFTERBURNER 439 | TURB ENG AFTERBURNER STAGE ACTIVE 440 | TURB ENG AFTERBURNER PCT ACTIVE 441 | TURB ENG JET THRUST 442 | TURB ENG BLEED AIR 443 | TURB ENG TANK SELECTOR 444 | TURB ENG TANKS USED 445 | TURB ENG NUM TANKS USED 446 | TURB ENG FUEL FLOW PPH 447 | TURB ENG FUEL AVAILABLE 448 | TURB ENG PRIMARY NOZZLE PERCENT 449 | TURB ENG REVERSE NOZZLE PERCENT 450 | TURB ENG VIBRATION 451 | TURB ENG IGNITION SWITCH 452 | TURB ENG MASTER STARTER SWITCH 453 | ENG FAILED 454 | PARTIAL PANEL ADF 455 | PARTIAL PANEL AIRSPEED 456 | PARTIAL PANEL ALTIMETER 457 | PARTIAL PANEL ATTITUDE 458 | PARTIAL PANEL COMM 459 | PARTIAL PANEL COMPASS 460 | PARTIAL PANEL ELECTRICAL 461 | PARTIAL PANEL AVIONICS 462 | PARTIAL PANEL ENGINE 463 | PARTIAL PANEL FUEL INDICATOR 464 | PARTIAL PANEL HEADING 465 | PARTIAL PANEL VERTICAL VELOCITY 466 | PARTIAL PANEL TRANSPONDER 467 | PARTIAL PANEL NAV 468 | PARTIAL PANEL PITOT 469 | PARTIAL PANEL TURN COORDINATOR 470 | PARTIAL PANEL VACUUM 471 | FUEL TANK CENTER LEVEL 472 | FUEL TANK CENTER CAPACITY 473 | FUEL TANK CENTER QUANTITY 474 | FUEL TANK CENTER2 LEVEL 475 | FUEL TANK CENTER2 CAPACITY 476 | FUEL TANK CENTER2 QUANTITY 477 | FUEL TANK CENTER3 LEVEL 478 | FUEL TANK CENTER3 CAPACITY 479 | FUEL TANK CENTER3 QUANTITY 480 | FUEL TANK LEFT MAIN LEVEL 481 | FUEL TANK LEFT MAIN CAPACITY 482 | FUEL TANK LEFT MAIN QUANTITY 483 | FUEL TANK LEFT AUX LEVEL 484 | FUEL TANK LEFT AUX CAPACITY 485 | FUEL TANK LEFT AUX QUANTITY 486 | FUEL TANK LEFT TIP LEVEL 487 | FUEL TANK LEFT TIP CAPACITY 488 | FUEL TANK LEFT TIP QUANTITY 489 | FUEL LEFT QUANTITY 490 | FUEL TANK RIGHT MAIN LEVEL 491 | FUEL TANK RIGHT MAIN CAPACITY 492 | FUEL TANK RIGHT MAIN QUANTITY 493 | FUEL TANK RIGHT AUX LEVEL 494 | FUEL TANK RIGHT AUX CAPACITY 495 | FUEL TANK RIGHT AUX QUANTITY 496 | FUEL TANK RIGHT TIP LEVEL 497 | FUEL TANK RIGHT TIP CAPACITY 498 | FUEL TANK RIGHT TIP QUANTITY 499 | FUEL RIGHT QUANTITY 500 | FUEL TANK EXTERNAL1 LEVEL 501 | FUEL TANK EXTERNAL1 CAPACITY 502 | FUEL TANK EXTERNAL1 QUANTITY 503 | FUEL TANK EXTERNAL2 LEVEL 504 | FUEL TANK EXTERNAL2 CAPACITY 505 | FUEL TANK EXTERNAL2 QUANTITY 506 | FUEL TOTAL QUANTITY 507 | FUEL TOTAL CAPACITY 508 | FUEL LEFT CAPACITY 509 | FUEL RIGHT CAPACITY 510 | FUEL WEIGHT PER GALLON 511 | FUEL TANK SELECTOR 512 | FUEL CROSS FEED 513 | NUM FUEL SELECTORS 514 | FUEL SELECTED QUANTITY PERCENT 515 | FUEL SELECTED QUANTITY 516 | FUEL TOTAL QUANTITY WEIGHT 517 | FUEL SELECTED TRANSFER MODE 518 | FUEL DUMP SWITCH 519 | FUEL DUMP ACTIVE 520 | DROPPABLE OBJECTS COUNT 521 | DROPPABLE OBJECTS TYPE 522 | DROPPABLE OBJECTS UI NAME 523 | WARNING FUEL 524 | WARNING FUEL LEFT 525 | WARNING FUEL RIGHT 526 | WARNING VACUUM 527 | WARNING VACUUM LEFT 528 | WARNING VACUUM RIGHT 529 | WARNING OIL PRESSURE 530 | WARNING VOLTAGE 531 | WARNING LOW HEIGHT 532 | AUTOPILOT AVAILABLE 533 | FLAPS AVAILABLE 534 | STALL HORN AVAILABLE 535 | ENGINE MIXURE AVAILABLE 536 | CARB HEAT AVAILABLE 537 | SPOILER AVAILABLE 538 | STROBES AVAILABLE 539 | PROP TYPE AVAILABLE 540 | TOE BRAKES AVAILABLE 541 | IS TAIL DRAGGER 542 | SYSTEMS AVAILABLE 543 | INSTRUMENTS AVAILABLE 544 | FUEL PUMP 545 | MANUAL FUEL PUMP HANDLE 546 | ALTERNATE STATIC SOURCE OPEN 547 | BLEED AIR SOURCE CONTROL 548 | ELECTRICAL MASTER BATTERY 549 | ELECTRICAL OLD CHARGING AMPS 550 | ELECTRICAL TOTAL LOAD AMPS 551 | ELECTRICAL BATTERY LOAD 552 | ELECTRICAL BATTERY VOLTAGE 553 | ELECTRICAL MAIN BUS VOLTAGE 554 | ELECTRICAL MAIN BUS AMPS 555 | ELECTRICAL AVIONICS BUS VOLTAGE 556 | ELECTRICAL AVIONICS BUS AMPS 557 | ELECTRICAL HOT BATTERY BUS VOLTAGE 558 | ELECTRICAL HOT BATTERY BUS AMPS 559 | ELECTRICAL BATTERY BUS VOLTAGE 560 | ELECTRICAL BATTERY BUS AMPS 561 | ELECTRICAL GENALT BUS VOLTAGE 562 | ELECTRICAL GENALT BUS AMPS 563 | CIRCUIT GENERAL PANEL ON 564 | CIRCUIT FLAP MOTOR ON 565 | CIRCUIT GEAR MOTOR ON 566 | CIRCUIT AUTOPILOT ON 567 | CIRCUIT AVIONICS ON 568 | CIRCUIT PITOT HEAT ON 569 | CIRCUIT PROP SYNC ON 570 | CIRCUIT AUTO FEATHER ON 571 | CIRCUIT AUTO BRAKES ON 572 | CIRCUIT STANDY VACUUM ON 573 | CIRCUIT STANDBY VACUUM ON 574 | CIRCUIT MARKER BEACON ON 575 | CIRCUIT GEAR WARNING ON 576 | CIRCUIT HYDRAULIC PUMP ON 577 | AMBIENT DENSITY 578 | AMBIENT TEMPERATURE 579 | AMBIENT PRESSURE 580 | AMBIENT WIND VELOCITY 581 | AMBIENT WIND DIRECTION 582 | AMBIENT WIND X 583 | AMBIENT WIND Y 584 | AMBIENT WIND Z 585 | AMBIENT PRECIP STATE 586 | AMBIENT IN CLOUD 587 | AMBIENT VISIBILITY 588 | BAROMETER PRESSURE 589 | SEA LEVEL PRESSURE 590 | TOTAL AIR TEMPERATURE 591 | STANDARD ATM TEMPERATURE 592 | AIRCRAFT WIND X 593 | AIRCRAFT WIND Y 594 | AIRCRAFT WIND Z 595 | HYDRAULIC PRESSURE 596 | HYDRAULIC RESERVOIR PERCENT 597 | HYDRAULIC SYSTEM INTEGRITY 598 | HYDRAULIC SWITCH 599 | GEAR HYDRAULIC PRESSURE 600 | CONCORDE VISOR NOSE HANDLE 601 | CONCORDE VISOR POSITION PERCENT 602 | CONCORDE NOSE ANGLE 603 | RADIOS AVAILABLE 604 | COM TRANSMIT 605 | COM RECEIVE ALL 606 | COM RECIEVE ALL 607 | NAV SOUND 608 | DME SOUND 609 | ADF SOUND 610 | ADF CARD 611 | MARKER SOUND 612 | COM AVAILABLE 613 | COM ACTIVE FREQUENCY 614 | COM STANDBY FREQUENCY 615 | COM STATUS 616 | COM TEST 617 | TRANSPONDER AVAILABLE 618 | TRANSPONDER CODE 619 | ADF AVAILABLE 620 | ADF FREQUENCY 621 | ADF EXT FREQUENCY 622 | ADF ACTIVE FREQUENCY 623 | ADF STANDBY FREQUENCY 624 | ADF LATLONALT 625 | ADF SIGNAL 626 | ADF RADIAL 627 | ADF IDENT 628 | ADF NAME 629 | NAV AVAILABLE 630 | NAV ACTIVE FREQUENCY 631 | NAV STANDBY FREQUENCY 632 | NAV SIGNAL 633 | NAV IDENT 634 | NAV NAME 635 | NAV CODES 636 | NAV HAS NAV 637 | NAV HAS LOCALIZER 638 | NAV HAS DME 639 | NAV HAS GLIDE SLOPE 640 | NAV BACK COURSE FLAGS 641 | NAV MAGVAR 642 | NAV RADIAL 643 | NAV RADIAL ERROR 644 | NAV LOCALIZER 645 | NAV GLIDE SLOPE 646 | NAV GLIDE SLOPE ERROR 647 | NAV CDI 648 | NAV GSI 649 | NAV TOFROM 650 | NAV GS FLAG 651 | NAV OBS 652 | NAV DME 653 | NAV DMESPEED 654 | NAV VOR LATLONALT 655 | NAV GS LATLONALT 656 | NAV DME LATLONALT 657 | NAV RELATIVE BEARING TO STATION 658 | MARKER BEACON STATE 659 | INNER MARKER 660 | MIDDLE MARKER 661 | OUTER MARKER 662 | INNER MARKER LATLONALT 663 | MIDDLE MARKER LATLONALT 664 | OUTER MARKER LATLONALT 665 | SELECTED DME 666 | REALISM 667 | AUTO COORDINATION 668 | UNLIMITED FUEL 669 | REALISM CRASH WITH OTHERS 670 | REALISM CRASH DETECTION 671 | MANUAL INSTRUMENT LIGHTS 672 | TRUE AIRSPEED SELECTED 673 | ATC TYPE 674 | ATC MODEL 675 | ATC HEAVY 676 | ATC ID 677 | ATC AIRLINE 678 | ATC FLIGHT NUMBER 679 | STRUCT LATLONALT 680 | STRUCT LATLONALTPBH 681 | STRUCT PBH32 682 | STRUCT DAMAGEVISIBLE 683 | STRUCT SURFACE RELATIVE VELOCITY 684 | STRUCT WORLDVELOCITY 685 | STRUCT WORLD ROTATION VELOCITY 686 | STRUCT BODY VELOCITY 687 | STRUCT BODY ROTATION VELOCITY 688 | STRUCT BODY ROTATION ACCELERATION 689 | STRUCT WORLD ACCELERATION 690 | STRUCT ENGINE POSITION 691 | STRUCT AMBIENT WIND 692 | STRUCT REALISM VARS 693 | STRUC HEADING HOLD PID CONSTS 694 | STRUC AIRSPEED HOLD PID CONSTS 695 | STRUCT EYEPOINT DYNAMIC ANGLE 696 | STRUCT EYEPOINT DYNAMIC OFFSET 697 | PITOT HEAT 698 | PITOT ICE PCT 699 | SMOKE ENABLE 700 | SMOKESYSTEM AVAILABLE 701 | G FORCE 702 | SEMIBODY LOADFACTOR X 703 | SEMIBODY LOADFACTOR Y 704 | SEMIBODY LOADFACTOR Z 705 | SEMIBODY LOADFACTOR YDOT 706 | MAX G FORCE 707 | MIN G FORCE 708 | SUCTION PRESSURE 709 | RAD INS SWITCH 710 | TYPICAL DESCENT RATE 711 | VISUAL MODEL RADIUS 712 | SIMULATED RADIUS 713 | IS USER SIM 714 | CONTROLLABLE 715 | HEADING INDICATOR 716 | TITLE 717 | CATEGORY 718 | SIM DISABLED 719 | PROP DEICE SWITCH 720 | STRUCTURAL DEICE SWITCH 721 | STRUCTURAL ICE PCT 722 | ARTIFICIAL GROUND ELEVATION 723 | SURFACE INFO VALID 724 | SURFACE TYPE 725 | SURFACE CONDITION 726 | PUSHBACK STATE 727 | PUSHBACK ANGLE 728 | PUSHBACK CONTACTX 729 | PUSHBACK CONTACTY 730 | PUSHBACK CONTACTZ 731 | PUSHBACK WAIT 732 | HSI CDI NEEDLE 733 | HSI GSI NEEDLE 734 | HSI CDI NEEDLE VALID 735 | HSI GSI NEEDLE VALID 736 | HSI TF FLAGS 737 | HSI BEARING 738 | HSI BEARING VALID 739 | HSI HAS LOCALIZER 740 | HSI SPEED 741 | HSI DISTANCE 742 | HSI STATION IDENT 743 | IS SLEW ACTIVE 744 | IS SLEW ALLOWED 745 | ATC SUGGESTED MIN RWY TAKEOFF 746 | ATC SUGGESTED MIN RWY LANDING 747 | YAW STRING ANGLE 748 | YAW STRING PCT EXTENDED 749 | INDUCTOR COMPASS PERCENT DEVIATION 750 | INDUCTOR COMPASS HEADING REF 751 | ANEMOMETER PCT RPM 752 | GPS POSITION LAT 753 | GPS POSITION LON 754 | GPS POSITION ALT 755 | GPS MAGVAR 756 | GPS IS ACTIVE FLIGHT PLAN 757 | GPS IS ACTIVE WAY POINT 758 | GPS IS ARRIVED 759 | GPS IS DIRECTTO FLIGHTPLAN 760 | GPS GROUND SPEED 761 | GPS GROUND TRUE HEADING 762 | GPS GROUND MAGNETIC TRACK 763 | GPS GROUND TRUE TRACK 764 | GPS ETE 765 | GPS ETA 766 | GPS WP DISTANCE 767 | GPS WP BEARING 768 | GPS WP TRUE BEARING 769 | GPS WP CROSS TRK 770 | GPS WP DESIRED TRACK 771 | GPS WP TRUE REQ HDG 772 | GPS WP VERTICAL SPEED 773 | GPS WP TRACK ANGLE ERROR 774 | GPS WP NEXT ID 775 | GPS WP NEXT LAT 776 | GPS WP NEXT LON 777 | GPS WP NEXT ALT 778 | GPS WP PREV VALID 779 | GPS WP PREV ID 780 | GPS WP PREV LAT 781 | GPS WP PREV LON 782 | GPS WP PREV ALT 783 | GPS WP ETE 784 | GPS WP ETA 785 | GPS COURSE TO STEER 786 | GPS FLIGHT PLAN WP INDEX 787 | GPS FLIGHT PLAN WP COUNT 788 | GPS IS ACTIVE WP LOCKED 789 | GPS IS APPROACH LOADED 790 | GPS IS APPROACH ACTIVE 791 | GPS APPROACH MODE 792 | GPS APPROACH WP TYPE 793 | GPS APPROACH IS WP RUNWAY 794 | GPS APPROACH SEGMENT TYPE 795 | GPS APPROACH AIRPORT ID 796 | GPS APPROACH APPROACH INDEX 797 | GPS APPROACH APPROACH ID 798 | GPS APPROACH APPROACH TYPE 799 | GPS APPROACH TRANSITION INDEX 800 | GPS APPROACH TRANSITION ID 801 | GPS APPROACH IS FINAL 802 | GPS APPROACH IS MISSED 803 | GPS APPROACH TIMEZONE DEVIATION 804 | GPS APPROACH WP INDEX 805 | GPS APPROACH WP COUNT 806 | GPS TARGET DISTANCE 807 | GPS TARGET ALTITUDE 808 | USER INPUT ENABLED 809 | ROTOR BRAKE HANDLE POS 810 | ROTOR BRAKE ACTIVE 811 | ROTOR CLUTCH SWITCH POS 812 | ROTOR CLUTCH ACTIVE 813 | ROTOR TEMPERATURE 814 | ROTOR CHIP DETECTED 815 | ROTOR GOV SWITCH POS 816 | ROTOR GOV ACTIVE 817 | ROTOR LATERAL TRIM PCT 818 | ROTOR RPM PCT 819 | ROTOR ROTATION ANGLE 820 | COLLECTIVE POSITION 821 | DISK PITCH ANGLE 822 | DISK BANK ANGLE 823 | DISK PITCH PCT 824 | DISK BANK PCT 825 | DISK CONING PCT 826 | GEAR DAMAGE BY SPEED 827 | GEAR SPEED EXCEEDED 828 | FLAP DAMAGE BY SPEED 829 | FLAP SPEED EXCEEDED 830 | ESTIMATED CRUISE SPEED 831 | ESTIMATED FUEL FLOW 832 | EYEPOINT POSITION 833 | NAV VOR LLAF64 834 | NAV GS LLAF64 835 | NAV RAW GLIDE SLOPE 836 | WINDSHIELD RAIN EFFECT AVAILABLE 837 | STATIC CG TO GROUND 838 | STATIC PITCH 839 | CRASH SEQUENCE 840 | CRASH FLAG 841 | APPLY HEAT TO SYSTEMS 842 | TOW RELEASE HANDLE 843 | TOW CONNECTION 844 | APU PCT RPM 845 | APU PCT STARTER 846 | APU VOLTS 847 | APU GENERATOR SWITCH 848 | APU GENERATOR ACTIVE 849 | APU ON FIRE DETECTED 850 | PRESSURIZATION CABIN ALTITUDE 851 | PRESSURIZATION CABIN ALTITUDE GOAL 852 | PRESSURIZATION CABIN ALTITUDE RATE 853 | PRESSURIZATION PRESSURE DIFFERENTIAL 854 | PRESSURIZATION DUMP SWITCH 855 | FIRE BOTTLE SWITCH 856 | FIRE BOTTLE DISCHARGED 857 | CABIN NO SMOKING ALERT SWITCH 858 | CABIN SEATBELTS ALERT SWITCH 859 | GPWS WARNING 860 | GPWS SYSTEM ACTIVE 861 | IS LATITUDE LONGITUDE FREEZE ON 862 | IS ALTITUDE FREEZE ON 863 | IS ATTITUDE FREEZE ON 864 | NUM SLING CABLES 865 | SLING OBJECT ATTACHED 866 | SLING CABLE BROKEN 867 | SLING CABLE EXTENDED LENGTH 868 | SLING ACTIVE PAYLOAD STATION 869 | SLING HOIST PERCENT DEPLOYED 870 | SLING HOIST SWITCH 871 | SLING HOOK IN PICKUP MODE 872 | IS ATTACHED TO SLING 873 | CABLE CAUGHT BY TAILHOOK 874 | EXTERNAL SYSTEM VALUE 875 | ANNUNCIATOR SWITCH 876 | AUTOBRAKES ACTIVE 877 | REJECTED TAKEOFF BRAKES ACTIVE 878 | SHUTOFF VALVE PULLED 879 | LIGHT POTENTIOMETER 880 | FAKE AC LWR 881 | FAKE AC UPR 882 | FAKE AC TRIM L 883 | FAKE AC TRIM R 884 | FAKE WINDOW HEAT L 885 | FAKE WINDOW HEAT R 886 | FAKE BUS TIE 887 | FAKE EXT PWR 888 | FAKE GEN CONT 889 | FAKE UTIL PWR L 890 | FAKE UTIL PWR R 891 | FAKE CRT TANK PUMP L 892 | FAKE CRT TANK PUMP R 893 | FAKE FUEL MAIN AFT 894 | FAKE FUEL MAIN FWD 895 | FAKE FUEL OVRD AFT 896 | FAKE FUEL OVRD FWD 897 | FAKE STAB TANK PUMP L 898 | FAKE STAB TANK PUMP R 899 | FAKE HYD PUMP SWITCH 900 | FAKE O2 YD LOWER 901 | FAKE O2 YD UPPER 902 | FAKE APU BLEED 903 | FAKE BLEED 904 | FAKE ISOLATION VALVE L 905 | FAKE ISOLATION VALVE R 906 | FAKE AC FLT DECK 907 | FAKE AC PASS TEMP 908 | FAKE STANDBY POWER 909 | FAKE DEMAND PUMP SEL 910 | FAKE IRS C 911 | FAKE IRS L 912 | FAKE IRS R 913 | FAKE ANTI ICE NACELLE 914 | FAKE ANTI ICE WING 915 | FAKE OUTFLOW VALVES 916 | FAKE XFEED 917 | FAKE EEC 918 | FAKE PACK 919 | FAKE EMERG LIGHTS 920 | FAKE TRIM STAB 921 | FAKE CARGO ARM AFT 922 | FAKE XPNDR 923 | FAKE IDENT 924 | FAKE NO SMOKING 925 | FAKE SEATBELTS 926 | FAKE CARGO TEMP 927 | FAKE EMERGENCY LIGHT 928 | AUTOPILOT DISENGAGED 929 | FAKE APU GEN SWITCH 930 | BREAKER AVNFAN 931 | BREAKER AUTOPILOT 932 | BREAKER GPS 933 | BREAKER NAVCOM1 934 | BREAKER NAVCOM2 935 | BREAKER NAVCOM3 936 | BREAKER ADF 937 | BREAKER XPNDR 938 | BREAKER FLAP 939 | BREAKER INST 940 | BREAKER AVNBUS1 941 | BREAKER AVNBUS2 942 | BREAKER TURNCOORD 943 | BREAKER INSTLTS 944 | BREAKER ALTFLD 945 | BREAKER WARN 946 | BREAKER LTS PWR 947 | PILOT TRANSMITTER TYPE 948 | COPILOT TRANSMITTER TYPE 949 | PILOT TRANSMITTING 950 | COPILOT TRANSMITTING 951 | SPEAKER ACTIVE 952 | INTERCOM SYSTEM ACTIVE 953 | AUDIO PANEL VOLUME 954 | MARKER BEACON SENSITIVITY HIGH 955 | MARKER BEACON TEST MUTE 956 | INTERCOM MODE 957 | COM RECEIVE 958 | AUTOPILOT ALTITUDE ARM 959 | COM VOLUME 960 | NAV VOLUME 961 | ATC CLEARED IFR 962 | ATC IFR FP TO REQUEST 963 | ATC RUNWAY SELECTED 964 | ATC TAXIPATH DISTANCE 965 | ATC RUNWAY START DISTANCE 966 | ATC RUNWAY END DISTANCE 967 | ATC RUNWAY DISTANCE 968 | ATC RUNWAY RELATIVE POSITION X 969 | ATC RUNWAY RELATIVE POSITION Y 970 | ATC RUNWAY RELATIVE POSITION Z 971 | ATC RUNWAY TDPOINT RELATIVE POSITION X 972 | ATC RUNWAY TDPOINT RELATIVE POSITION Y 973 | ATC RUNWAY TDPOINT RELATIVE POSITION Z 974 | ATC RUNWAY HEADING DEGREES TRUE 975 | ATC RUNWAY LENGTH 976 | ATC RUNWAY WIDTH 977 | ATC RUNWAY AIRPORT NAME 978 | SLOPE TO ATC RUNWAY 979 | ATC CLEARED TAKEOFF 980 | ATC CLEARED LANDING 981 | ATC CLEARED TAXI 982 | ON ANY RUNWAY 983 | ATC FLIGHTPLAN DIFF HEADING 984 | ATC FLIGHTPLAN DIFF ALT 985 | ATC FLIGHTPLAN DIFF DISTANCE 986 | ATC PREVIOUS WAYPOINT ALTITUDE 987 | ATC CURRENT WAYPOINT ALTITUDE 988 | ASSISTANCE LANDING ENABLED 989 | COM1 STORED FREQUENCY 990 | COM2 STORED FREQUENCY 991 | COM3 STORED FREQUENCY 992 | RUDDER TRIM DISABLED 993 | AILERON TRIM DISABLED 994 | ELEVATOR TRIM DISABLED 995 | PLANE TOUCHDOWN LATITUDE 996 | PLANE TOUCHDOWN LONGITUDE 997 | PLANE TOUCHDOWN PITCH DEGREES 998 | PLANE TOUCHDOWN BANK DEGREES 999 | PLANE TOUCHDOWN HEADING DEGREES MAGNETIC 1000 | PLANE TOUCHDOWN HEADING DEGREES TRUE 1001 | PLANE TOUCHDOWN NORMAL VELOCITY 1002 | TURB ENG IGNITION SWITCH EX1 1003 | TURB ENG IS IGNITING 1004 | PLANE IN PARKING STATE 1005 | ELT ACTIVATED 1006 | RECIP ENG ENGINE MASTER SWITCH 1007 | RECIP ENG GLOW PLUG ACTIVE 1008 | LIGHT GLARESHIELD 1009 | LIGHT PEDESTRAL 1010 | LIGHT GLARESHIELD ON 1011 | LIGHT PEDESTRAL ON 1012 | CIRCUIT NAVCOM1 ON 1013 | CIRCUIT NAVCOM2 ON 1014 | CIRCUIT NAVCOM3 ON 1015 | AIRSPEED TRUE RAW 1016 | GENERAL ENG FUEL PUMP SWITCH EX1 1017 | FUEL TRANSFER PUMP ON 1018 | IS ANY INTERIOR LIGHT ON 1019 | GPS FLIGHTPLAN TOTAL DISTANCE 1020 | CIRCUIT ON 1021 | CIRCUIT SWITCH ON 1022 | BUS LOOKUP INDEX 1023 | BUS CONNECTION ON 1024 | BATTERY CONNECTION ON 1025 | ALTERNATOR CONNECTION ON 1026 | CIRCUIT CONNECTION ON 1027 | BUS BREAKER PULLED 1028 | BATTERY BREAKER PULLED 1029 | ALTERNATOR BREAKER PULLED 1030 | CIRCUIT BREAKER PULLED 1031 | CAMERA STATE 1032 | CAMERA SUBSTATE 1033 | SMART CAMERA ACTIVE 1034 | CAMERA REQUEST ACTION 1035 | ADF VOLUME 1036 | BLEED AIR APU 1037 | BLEED AIR ENGINE 1038 | APU BLEED TO ENGINE 1039 | EXTERNAL POWER CONNECTION ON 1040 | EXTERNAL POWER BREAKER PULLED 1041 | EXTERNAL POWER AVAILABLE 1042 | EXTERNAL POWER ON 1043 | -------------------------------------------------------------------------------- /references/unique_units.txt: -------------------------------------------------------------------------------- 1 | # Nicked from /MSFS SDK/Samples/SimvarWatcher/units.cs 2 | 3 | meter 4 | centimeter 5 | kilometer 6 | millimeter 7 | mile 8 | nmile 9 | decinmile 10 | foot 11 | inch 12 | yard 13 | meter scaler 256 14 | square meter 15 | square centimeter 16 | square kilometer 17 | square millimeter 18 | square mile 19 | square feet 20 | square inch 21 | square yard 22 | meter cubed 23 | liter 24 | gallon 25 | quart 26 | fs7 oil quantity 27 | cubic centimeter 28 | cubic kilometer 29 | cubic millimeter 30 | cubic mile 31 | cubic feet 32 | cubic inch 33 | cubic yard 34 | kelvin 35 | rankine 36 | farenheit 37 | celsius 38 | GLOBALP->eng1.oil_tmp 39 | celsius fs7 egt 40 | celsius scaler 16k 41 | celsius scaler 256 42 | celsius scaler 1/256 43 | part 44 | half 45 | third 46 | percent 47 | percent over 100 48 | bel 49 | decibel 50 | more_than_a_half 51 | times 52 | ratio 53 | number 54 | scaler 55 | percentage 56 | percent scaler 16k 57 | percent scaler 32k 58 | percent scaler 2pow23 59 | position 60 | position 32k 61 | position 16k 62 | position 128 63 | keyframe 64 | per radian 65 | per degree 66 | radian 67 | round 68 | degree 69 | grad 70 | angl16 71 | angl32 72 | degree latitude 73 | degree longitude 74 | meter latitude 75 | radian per second 76 | revolution per minute 77 | minute per round 78 | nice minute per round 79 | degree per second 80 | GLOBALP->delta_heading_rate 81 | rpm 1 over 16k 82 | meter/second 83 | meter per minute 84 | feet/second 85 | feet/minute 86 | kilometer/hour 87 | knot 88 | mile per hour 89 | GLOBALP->vertical_speed 90 | knot scaler 128 91 | meter per second scaler 256 92 | per second 93 | per minute 94 | per hour 95 | mach 96 | mach 3d2 over 64k 97 | pascal 98 | kilopascal 99 | kilogram force per square centimeter 100 | millimeter of mercury 101 | centimeter of mercury 102 | inch of mercury 103 | atmosphere 104 | millimeter of water 105 | pound-force per square inch 106 | pound-force per square foot 107 | bar 108 | boost cmHg 109 | boost inHg 110 | boost psi 111 | GLOBALP->eng1.manifold_pressure 112 | GLOBALP->eng1.oil_prs 113 | psf scaler 16k 114 | psi scaler 16k 115 | psi 4 over 16k 116 | millibar 117 | millibar scaler 16 118 | second 119 | minute 120 | hour 121 | day 122 | hour over 10 123 | year 124 | Watt 125 | ft lb per second 126 | meter cubed per second 127 | gallon per hour 128 | liter per hour 129 | kilogram per second 130 | pound per hour 131 | kilogram 132 | pound 133 | pound scaler 256 134 | slug 135 | slug feet squared 136 | kilogram meter squared 137 | ampere 138 | fs7 charging amps 139 | volt 140 | Hertz 141 | Kilohertz 142 | Megahertz 143 | Frequency BCD32 144 | Frequency BCD16 145 | Frequency ADF BCD32 146 | Enum 147 | Bco16 148 | mask 149 | flags 150 | meter per second squared 151 | GForce 152 | G Force 624 scaled 153 | feet per second squared 154 | kilogram per cubic meter 155 | Slug per cubic feet 156 | newton meter 157 | foot pound 158 | lbf-feet 159 | kilogram meter 160 | poundal feet 161 | -------------------------------------------------------------------------------- /references/units.txt: -------------------------------------------------------------------------------- 1 | # Nicked from /MSFS SDK/Samples/SimvarWatcher/units.cs 2 | 3 | Frequency BCD32 4 | inHg 5 | ft/min 6 | m 7 | yard 8 | meters per second 9 | Slugs per cubic foot 10 | meter scaler 256 11 | foot 12 | nautical mile 13 | percent over 100 14 | percentage 15 | fahrenheit 16 | kilogram per cubic meter 17 | per second 18 | kilogram meters 19 | meter/second 20 | in2 21 | in3 22 | meters per second scaler 256 23 | ft2 24 | ft3 25 | decinmile 26 | amperes 27 | nice minutes per round 28 | Enum 29 | farenheit 30 | meter per second scaler 256 31 | Bco16 32 | Slugs per cubic feet 33 | feet 34 | minutes 35 | decibel 36 | degree latitude 37 | meters per second squared 38 | halfs 39 | feet/second 40 | pound-force per square foot 41 | Slug/ft3 42 | kilometer/hour 43 | hour over 10 44 | minute per round 45 | slugs 46 | MHz 47 | cm 48 | sq cm 49 | meters/second 50 | Boolean 51 | Megahertz 52 | km2 53 | km3 54 | millibar scaler 16 55 | millimeter of mercury 56 | percent 57 | radian per second 58 | meters cubed 59 | inches 60 | pounds per hour 61 | foot-pounds 62 | degrees per second ang16 63 | rpms 64 | cubic kilometers 65 | radians per second 66 | slugs feet squared 67 | newton meters 68 | bar 69 | psf scaler 16k 70 | part 71 | cu yd 72 | meter latitude 73 | mile 74 | meters per minute 75 | kelvin 76 | machs 77 | flags 78 | seconds 79 | psi scaler 16k 80 | per minute 81 | ft 82 | ampere 83 | kPa 84 | half 85 | sq ft 86 | quarts 87 | kph 88 | fs7 charging amps 89 | pound 90 | geepounds 91 | degree 92 | kilograms per cubic meter 93 | keyframe 94 | slug 95 | Slug per cubic foot 96 | cubic inches 97 | feet/minute 98 | mm2 99 | mm3 100 | days 101 | square inch 102 | millimeters of water 103 | Hz 104 | years 105 | Slug per cubic feet 106 | Hertz 107 | thirds 108 | millimeter of water 109 | bel 110 | in 111 | sq in 112 | second 113 | day 114 | kilometers 115 | degrees per second 116 | millimeters of mercury 117 | pascals 118 | degrees angl16 119 | mmHg 120 | m/s 121 | knots 122 | kilogram per second 123 | decibels 124 | cubic miles 125 | inHg 64 over 64k 126 | mph 127 | boost inHg 128 | celsius scaler 1/256 129 | foot per second squared 130 | hours 131 | kg 132 | km 133 | sq km 134 | decinmiles 135 | cmHg 136 | millibars 137 | times 138 | degrees angl32 139 | rankine 140 | number 141 | square miles 142 | kilogram force per square centimeter 143 | degree per second 144 | knot scaler 128 145 | newton meter 146 | mach 147 | scaler 148 | hour 149 | mbar 150 | square millimeter 151 | atmospheres 152 | kilogram meter 153 | position 154 | pounds 155 | miles 156 | third 157 | percent scaler 32k 158 | percent scaler 16k 159 | sq mm 160 | m2 161 | m3 162 | miles per hour 163 | radians 164 | knot 165 | centimeters 166 | volt 167 | square yard 168 | GLOBALP->eng1.manifold_pressure 169 | millimeters 170 | square foot 171 | kilograms 172 | cubic yards 173 | kilometers/hour 174 | meters latitude 175 | amps 176 | Nm 177 | millibars scaler 16 178 | gallon per hour 179 | cubic meter 180 | feet per second 181 | round 182 | kilogram meter squared 183 | cu cm 184 | cubic centimeters 185 | meters scaler 256 186 | cubic millimeters 187 | meters 188 | minute 189 | square yards 190 | mbars 191 | square feet 192 | geepound 193 | kilograms meter squared 194 | GLOBALP->eng1.oil_prs 195 | amp 196 | kilopascal 197 | liter per hour 198 | celsius fs7 egt 199 | Frequency ADF BCD32 200 | square meter 201 | decimiles 202 | pounds scaler 256 203 | Pa 204 | GForce 205 | degree longitude 206 | feet per second squared 207 | square centimeter 208 | yards 209 | ft-lbs 210 | pph 211 | gallons 212 | inches of mercury 213 | more_than_a_half 214 | meter 215 | nice minute per round 216 | meter per second 217 | hectopascal 218 | cubic inch 219 | kilograms per second 220 | cubic kilometer 221 | cu ft 222 | slug feet squared 223 | square centimeters 224 | cubic meters 225 | square millimeters 226 | GLOBALP->eng1.oil_tmp 227 | pound per hour 228 | revolution per minute 229 | minutes per round 230 | volts 231 | square mile 232 | decimile 233 | gallon 234 | degrees 235 | cm2 236 | cm3 237 | newtons per square meter 238 | cu m 239 | celsius scaler 16k 240 | nmiles 241 | psf 242 | square inches 243 | psi 244 | Bool 245 | fs7 oil quantity 246 | atmosphere 247 | cubic millimeter 248 | Kilohertz 249 | feet per minute 250 | meter cubed 251 | lbf-feet 252 | kgf meters 253 | degree per second ang16 254 | celsius scaler 256 255 | rpm 256 | newton per square meter 257 | cu in 258 | pascal 259 | per radian 260 | poundal feet 261 | numbers 262 | meter cubed per second 263 | per hour 264 | psi 4 over 16k 265 | foot pounds 266 | meters cubed per second 267 | psi fs7 oil pressure 268 | celsius fs7 oil temp 269 | atm 270 | kilometers per hour 271 | boost cmHg 272 | yd2 273 | position 128 274 | yd3 275 | cu km 276 | year 277 | gallons per hour 278 | G Force 279 | cubic yard 280 | kilogram 281 | meter per minute 282 | rounds 283 | cubic foot 284 | foot pound 285 | GLOBALP->delta_heading_rate 286 | boost psi 287 | degree angl16 288 | cubic centimeter 289 | pound scaler 256 290 | cubic feet 291 | nautical miles 292 | foot-pound 293 | quart 294 | hours over 10 295 | grads 296 | cu mm 297 | millimeter 298 | hectopascals 299 | degrees latitude 300 | G Force 624 scaled 301 | liter 302 | sq yd 303 | knots scaler 128 304 | ft lb per second 305 | degree angl32 306 | liters 307 | grad 308 | lbs 309 | inch 310 | position 32k 311 | position 16k 312 | bars 313 | degrees longitude 314 | mile per hour 315 | meter per second squared 316 | GLOBALP->vertical_speed 317 | liters per hour 318 | revolutions per minute 319 | keyframes 320 | centimeter of mercury 321 | sq m 322 | pound-force per square inch 323 | Watt 324 | bels 325 | angl16 326 | KgFSqCm 327 | mask 328 | rpm 1 over 16k 329 | kilometer 330 | square kilometers 331 | centimeter 332 | cubic mile 333 | Watts 334 | celsius 335 | ratio 336 | centimeters of mercury 337 | Frequency BCD16 338 | radian 339 | per degree 340 | nmile 341 | gph 342 | square meters 343 | angl32 344 | millibar 345 | KHz 346 | kilometer per hour 347 | mach 3d2 over 64k 348 | kgf meter 349 | percent scaler 2pow23 350 | square kilometer 351 | inch of mercury 352 | 353 | ### Unique unit names 354 | meter 355 | centimeter 356 | kilometer 357 | millimeter 358 | mile 359 | nmile 360 | decinmile 361 | foot 362 | inch 363 | yard 364 | meter scaler 256 365 | square meter 366 | square centimeter 367 | square kilometer 368 | square millimeter 369 | square mile 370 | square feet 371 | square inch 372 | square yard 373 | meter cubed 374 | liter 375 | gallon 376 | quart 377 | fs7 oil quantity 378 | cubic centimeter 379 | cubic kilometer 380 | cubic millimeter 381 | cubic mile 382 | cubic feet 383 | cubic inch 384 | cubic yard 385 | kelvin 386 | rankine 387 | farenheit 388 | celsius 389 | GLOBALP->eng1.oil_tmp 390 | celsius fs7 egt 391 | celsius scaler 16k 392 | celsius scaler 256 393 | celsius scaler 1/256 394 | part 395 | half 396 | third 397 | percent 398 | percent over 100 399 | bel 400 | decibel 401 | more_than_a_half 402 | times 403 | ratio 404 | number 405 | scaler 406 | percentage 407 | percent scaler 16k 408 | percent scaler 32k 409 | percent scaler 2pow23 410 | position 411 | position 32k 412 | position 16k 413 | position 128 414 | keyframe 415 | per radian 416 | per degree 417 | radian 418 | round 419 | degree 420 | grad 421 | angl16 422 | angl32 423 | degree latitude 424 | degree longitude 425 | meter latitude 426 | radian per second 427 | revolution per minute 428 | minute per round 429 | nice minute per round 430 | degree per second 431 | GLOBALP->delta_heading_rate 432 | rpm 1 over 16k 433 | meter/second 434 | meter per minute 435 | feet/second 436 | feet/minute 437 | kilometer/hour 438 | knot 439 | mile per hour 440 | GLOBALP->vertical_speed 441 | knot scaler 128 442 | meter per second scaler 256 443 | per second 444 | per minute 445 | per hour 446 | mach 447 | mach 3d2 over 64k 448 | pascal 449 | kilopascal 450 | kilogram force per square centimeter 451 | millimeter of mercury 452 | centimeter of mercury 453 | inch of mercury 454 | atmosphere 455 | millimeter of water 456 | pound-force per square inch 457 | pound-force per square foot 458 | bar 459 | boost cmHg 460 | boost inHg 461 | boost psi 462 | GLOBALP->eng1.manifold_pressure 463 | GLOBALP->eng1.oil_prs 464 | psf scaler 16k 465 | psi scaler 16k 466 | psi 4 over 16k 467 | millibar 468 | millibar scaler 16 469 | second 470 | minute 471 | hour 472 | day 473 | hour over 10 474 | year 475 | Watt 476 | ft lb per second 477 | meter cubed per second 478 | gallon per hour 479 | liter per hour 480 | kilogram per second 481 | pound per hour 482 | kilogram 483 | pound 484 | pound scaler 256 485 | slug 486 | slug feet squared 487 | kilogram meter squared 488 | ampere 489 | fs7 charging amps 490 | volt 491 | Hertz 492 | Kilohertz 493 | Megahertz 494 | Frequency BCD32 495 | Frequency BCD16 496 | Frequency ADF BCD32 497 | Enum 498 | Bco16 499 | mask 500 | flags 501 | meter per second squared 502 | GForce 503 | G Force 624 scaled 504 | feet per second squared 505 | kilogram per cubic meter 506 | Slug per cubic feet 507 | newton meter 508 | foot pound 509 | lbf-feet 510 | kilogram meter 511 | poundal feet 512 | -------------------------------------------------------------------------------- /simconnect/api.go: -------------------------------------------------------------------------------- 1 | package simconnect 2 | 3 | import ( 4 | "syscall" 5 | "unsafe" 6 | ) 7 | 8 | // SimConnect_Open: Used to send a request to the Flight Simulator server to open up communications with a new client. 9 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/General/SimConnect_Open.htm 10 | func (simco *SimConnect) Open(name string) error { 11 | // SimConnect_Open( 12 | // HANDLE * phSimConnect, 13 | // LPCSTR szName, 14 | // HWND hWnd, 15 | // DWORD UserEventWin32, 16 | // HANDLE hEventHandle, 17 | // DWORD ConfigIndex) 18 | 19 | const hwnd DWord = 0 20 | const userEventWin32 = WmUserSimConnect 21 | const eventHandle DWord = 0 22 | const configIndex DWord = 0 // TODO: make this a function parameter 23 | 24 | var namePtr *uint16 25 | namePtr, namePtrErr := syscall.UTF16PtrFromString(name) 26 | if namePtrErr != nil { 27 | return namePtrErr 28 | } 29 | 30 | args := []uintptr{ 31 | uintptr(unsafe.Pointer(&simco.handle)), 32 | uintptr(unsafe.Pointer(namePtr)), 33 | uintptr(hwnd), 34 | uintptr(userEventWin32), 35 | uintptr(eventHandle), 36 | uintptr(configIndex), 37 | } 38 | err := callProc(scOpen, args...) 39 | if err == nil { 40 | simco.connected = true 41 | } 42 | return err 43 | } 44 | 45 | // SimConnect_Close: Used to request that the communication with the server is ended. 46 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/General/SimConnect_Close.htm 47 | func (simco *SimConnect) Close() error { 48 | // SimConnect_Close( 49 | // HANDLE hSimConnect) 50 | 51 | args := []uintptr{ 52 | uintptr(simco.handle), 53 | } 54 | err := callProc(scClose, args...) 55 | if err == nil { 56 | simco.connected = false 57 | } 58 | return err 59 | } 60 | 61 | // SimConnect_CallDispatch: Used to process the next SimConnect message received through the specified callback function. 62 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/General/SimConnect_CallDispatch.htm 63 | // TODO: SimConnect_CallDispatch(HANDLE hSimConnect, DispatchProc pfcnDispatch, void * pContext) 64 | 65 | // SimConnect_GetNextDispatch: Used to process the next SimConnect message received, without the use of a callback function. 66 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/General/SimConnect_GetNextDispatch.htm 67 | func (simco *SimConnect) GetNextDispatch() (unsafe.Pointer, int32, error) { 68 | // SimConnect_GetNextDispatch( 69 | // HANDLE hSimConnect, 70 | // SIMCONNECT_RECV ** ppData, 71 | // DWORD * pcbData) 72 | 73 | var ppData unsafe.Pointer 74 | var ppDataLength DWord 75 | r1, _, err := procs[scGetNextDispatch].Call( 76 | uintptr(simco.handle), 77 | uintptr(unsafe.Pointer(&ppData)), 78 | uintptr(unsafe.Pointer(&ppDataLength)), 79 | ) 80 | return ppData, int32(r1), err 81 | } 82 | 83 | // SimConnect_RequestSystemState: Used to request information from a number of Flight Simulator system components. 84 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/General/SimConnect_RequestSystemState.htm 85 | func (simco *SimConnect) RequestSystemState(requestID DWord, state string) error { 86 | // SimConnect_RequestSystemState( 87 | // HANDLE hSimConnect, 88 | // SIMCONNECT_DATA_REQUEST_ID RequestID, 89 | // const char * szState) 90 | 91 | args := []uintptr{ 92 | uintptr(simco.handle), 93 | uintptr(requestID), 94 | uintptr(toCharPtr(state)), 95 | } 96 | return callProc(scRequestSystemState, args...) 97 | } 98 | 99 | // SimConnect_MapClientEventToSimEvent: Used to associate a client defined event ID with a Flight Simulator event name. 100 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/General/SimConnect_MapClientEventToSimEvent.htm 101 | func (simco *SimConnect) MapClientEventToSimEvent(eventID DWord, eventName string) error { 102 | // SimConnect_MapClientEventToSimEvent( 103 | // HANDLE hSimConnect, 104 | // SIMCONNECT_CLIENT_EVENT_ID EventID, 105 | // const char * EventName = "") 106 | 107 | args := []uintptr{ 108 | uintptr(simco.handle), 109 | uintptr(eventID), 110 | toCharPtr(eventName), 111 | } 112 | return callProc(scMapClientEventToSimEvent, args...) 113 | } 114 | 115 | // SimConnect_SubscribeToSystemEvent: Used to request that a specific system event is notified to the client. 116 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/General/SimConnect_SubscribeToSystemEvent.htm 117 | func (simco *SimConnect) SubscribeToSystemEvent(eventID DWord, systemEventName string) error { 118 | // SimConnect_SubscribeToSystemEvent( 119 | // HANDLE hSimConnect, 120 | // SIMCONNECT_CLIENT_EVENT_ID EventID, 121 | // const char * SystemEventName) 122 | 123 | args := []uintptr{ 124 | uintptr(simco.handle), 125 | uintptr(eventID), 126 | toCharPtr(systemEventName), 127 | } 128 | return callProc(scSubscribeToSystemEvent, args...) 129 | } 130 | 131 | // SimConnect_SetSystemEventState: Used to turn requests for event information from the server on and off. 132 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/General/SimConnect_SetSystemEventState.htm 133 | func (simco *SimConnect) SetSystemEventState(eventID, state DWord) error { 134 | // SIMCONNECTAPI SimConnect_SetSystemEventState( 135 | // HANDLE hSimConnect, 136 | // SIMCONNECT_CLIENT_EVENT_ID EventID, 137 | // SIMCONNECT_STATE dwState) 138 | 139 | args := []uintptr{ 140 | uintptr(simco.handle), 141 | uintptr(eventID), 142 | uintptr(state), 143 | } 144 | return callProc(scSetSystemEventState, args...) 145 | } 146 | 147 | // SimConnect_UnsubscribeFromSystemEvent: Used to request that notifications are no longer received for the specified system event. 148 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/General/SimConnect_UnsubscribeFromSystemEvent.htm 149 | func (simco *SimConnect) UnsubscribeFromSystemEvent(eventID DWord) error { 150 | // SimConnect_UnsubscribeFromSystemEvent( 151 | // HANDLE hSimConnect, 152 | // SIMCONNECT_CLIENT_EVENT_ID EventID) 153 | 154 | args := []uintptr{ 155 | uintptr(simco.handle), 156 | uintptr(eventID), 157 | } 158 | return callProc(scUnsubscribeFromSystemEvent, args...) 159 | } 160 | 161 | // SimConnect_SetNotificationGroupPriority: Used to set the priority of a notification group. 162 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/General/SimConnect_SetNotificationGroupPriority.htm 163 | func (simco *SimConnect) SetNotificationGroupPriority(groupID, priority DWord) error { 164 | // SimConnect_SetNotificationGroupPriority( 165 | // HANDLE hSimConnect, 166 | // SIMCONNECT_NOTIFICATION_GROUP_ID GroupID, 167 | // DWORD uPriority) 168 | 169 | args := []uintptr{ 170 | uintptr(simco.handle), 171 | uintptr(groupID), 172 | uintptr(priority), 173 | } 174 | return callProc(scSetNotificationGroupPriority, args...) 175 | } 176 | 177 | // SimConnect_Text: Displays text to the user. (This function is not currently available for use.) 178 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/General/SimConnect_Text.htm 179 | func (simco *SimConnect) Text(text string, textType DWord, timeSeconds float32, eventID DWord) error { 180 | // SimConnect_Text( 181 | // HANDLE hSimConnect, 182 | // SIMCONNECT_TEXT_TYPE type, 183 | // float fTimeSeconds, 184 | // SIMCONNECT_CLIENT_EVENT_ID EventID, 185 | // DWORD cbUnitSize, 186 | // void * pDataSet) 187 | 188 | size := len(text) 189 | args := []uintptr{ 190 | uintptr(simco.handle), 191 | uintptr(textType), 192 | uintptr(timeSeconds), 193 | uintptr(eventID), 194 | uintptr(DWord(size)), 195 | toCharPtr(text), 196 | } 197 | return callProc(scText, args...) 198 | } 199 | 200 | // Event And Data functions: 201 | 202 | // SimConnect_RequestDataOnSimObject: Used to request when the SimConnect client is to receive data values for a specific object. 203 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_RequestDataOnSimObject.htm 204 | func (simco *SimConnect) RequestDataOnSimObject(requestID, defineID, objectID, period, flags DWord) error { 205 | // SimConnect_RequestDataOnSimObject( 206 | // HANDLE hSimConnect, 207 | // SIMCONNECT_DATA_REQUEST_ID RequestID, 208 | // SIMCONNECT_DATA_DEFINITION_ID DefineID, 209 | // SIMCONNECT_OBJECT_ID ObjectID, 210 | // SIMCONNECT_PERIOD Period, 211 | // SIMCONNECT_DATA_REQUEST_FLAG Flags = 0, 212 | // DWORD origin = 0, 213 | // DWORD interval = 0, 214 | // DWORD limit = 0) 215 | 216 | const origin DWord = 0 217 | const interval DWord = 0 218 | const limit DWord = 0 219 | 220 | args := []uintptr{ 221 | uintptr(simco.handle), 222 | uintptr(requestID), 223 | uintptr(defineID), 224 | uintptr(objectID), 225 | uintptr(period), 226 | uintptr(flags), 227 | uintptr(origin), 228 | uintptr(interval), 229 | uintptr(limit), 230 | } 231 | return callProc(scRequestDataOnSimObject, args...) 232 | } 233 | 234 | // SimConnect_RequestDataOnSimObjectType: Used to retrieve information about simulation objects of a given type that are within a specified radius of the user's aircraft. 235 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_RequestDataOnSimObjectType.htm 236 | func (simco *SimConnect) RequestDataOnSimObjectType(requestID, defineID, radius, simobjectType DWord) error { 237 | // SimConnect_RequestDataOnSimObjectType( 238 | // HANDLE hSimConnect, 239 | // SIMCONNECT_DATA_REQUEST_ID RequestID, 240 | // SIMCONNECT_DATA_DEFINITION_ID DefineID, 241 | // DWORD dwRadiusMeters, 242 | // SIMCONNECT_SIMOBJECT_TYPE type) 243 | 244 | args := []uintptr{ 245 | uintptr(simco.handle), 246 | uintptr(requestID), 247 | uintptr(defineID), 248 | uintptr(radius), 249 | uintptr(simobjectType), 250 | } 251 | return callProc(scRequestDataOnSimObjectType, args...) 252 | } 253 | 254 | // SimConnect_AddClientEventToNotificationGroup: Used to add an individual client defined event to a notification group. 255 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_AddClientEventToNotificationGroup.htm 256 | func (simco *SimConnect) AddClientEventToNotificationGroup(groupID, eventID DWord, maskable bool) error { 257 | // SimConnect_AddClientEventToNotificationGroup( 258 | // HANDLE hSimConnect, 259 | // SIMCONNECT_NOTIFICATION_GROUP_ID GroupID, 260 | // SIMCONNECT_CLIENT_EVENT_ID EventID, 261 | // BOOL bMaskable = FALSE) 262 | 263 | args := []uintptr{ 264 | uintptr(simco.handle), 265 | uintptr(groupID), 266 | uintptr(eventID), 267 | uintptr(toBoolPtr(maskable)), 268 | } 269 | return callProc(scAddClientEventToNotificationGroup, args...) 270 | } 271 | 272 | // SimConnect_RemoveClientEvent: Used to remove a client defined event from a notification group. 273 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_RemoveClientEvent.htm 274 | func (simco *SimConnect) RemoveClientEvent(groupID, eventID DWord) error { 275 | // SimConnect_RemoveClientEvent( 276 | // HANDLE hSimConnect, 277 | // SIMCONNECT_NOTIFICATION_GROUP_ID GroupID, 278 | // SIMCONNECT_CLIENT_EVENT_ID EventID) 279 | 280 | args := []uintptr{ 281 | uintptr(simco.handle), 282 | uintptr(groupID), 283 | uintptr(eventID), 284 | } 285 | return callProc(scRemoveClientEvent, args...) 286 | } 287 | 288 | // SimConnect_TransmitClientEvent: Used to request that the Flight Simulator server transmit to all SimConnect clients the specified client event. 289 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_TransmitClientEvent.htm 290 | func (simco *SimConnect) TransmitClientEvent(objectID uint32, eventID uint32, data DWord, groupID DWord, flags DWord) error { 291 | // SimConnect_TransmitClientEvent( 292 | // HANDLE hSimConnect, 293 | // SIMCONNECT_OBJECT_ID ObjectID, 294 | // SIMCONNECT_CLIENT_EVENT_ID EventID, 295 | // DWORD dwData, 296 | // SIMCONNECT_NOTIFICATION_GROUP_ID GroupID, 297 | // SIMCONNECT_EVENT_FLAG Flags) 298 | 299 | args := []uintptr{ 300 | uintptr(simco.handle), 301 | uintptr(objectID), 302 | uintptr(eventID), 303 | uintptr(data), 304 | uintptr(groupID), 305 | uintptr(flags), 306 | } 307 | return callProc(scTransmitClientEvent, args...) 308 | } 309 | 310 | // SimConnect_MapClientDataNameToID: Used to associate an ID with a named client date area. 311 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_MapClientDataNameToID.htm 312 | func (simco *SimConnect) MapClientDataNameToID(clientDataName string, clientDataID DWord) error { 313 | // SimConnect_MapClientDataNameToID( 314 | // HANDLE hSimConnect, 315 | // const char * szClientDataName, 316 | // SIMCONNECT_CLIENT_DATA_ID ClientDataID) 317 | 318 | args := []uintptr{ 319 | uintptr(simco.handle), 320 | toCharPtr(clientDataName), 321 | uintptr(clientDataID), 322 | } 323 | return callProc(scMapClientDataNameToID, args...) 324 | } 325 | 326 | // SimConnect_RequestClientData: Used to request that the data in an area created by another client be sent to this client. 327 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_RequestClientData.htm 328 | func (simco *SimConnect) RequestClientData(clientDataID, requestID, defineID, period, flags DWord) error { 329 | // SimConnect_RequestClientData( 330 | // HANDLE hSimConnect, 331 | // SIMCONNECT_CLIENT_DATA_ID ClientDataID, 332 | // SIMCONNECT_DATA_REQUEST_ID RequestID, 333 | // SIMCONNECT_CLIENT_DATA_DEFINITION_ID DefineID, 334 | // SIMCONNECT_CLIENT_DATA_PERIOD Period = SIMCONNECT_CLIENT_DATA_PERIOD_ONCE, 335 | // SIMCONNECT_CLIENT_DATA_REQUEST_FLAG Flags = 0, 336 | // DWORD origin = 0, 337 | // DWORD interval = 0, 338 | // DWORD limit = 0) 339 | 340 | const origin DWord = 0 341 | const interval DWord = 0 342 | const limit DWord = 0 343 | 344 | args := []uintptr{ 345 | uintptr(simco.handle), 346 | uintptr(clientDataID), 347 | uintptr(requestID), 348 | uintptr(defineID), 349 | uintptr(period), 350 | uintptr(flags), 351 | uintptr(origin), 352 | uintptr(interval), 353 | uintptr(limit), 354 | } 355 | return callProc(scRequestClientData, args...) 356 | } 357 | 358 | // SimConnect_CreateClientData: Used to request the creation of a reserved data area for this client. 359 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_CreateClientData.htm 360 | func (simco *SimConnect) CreateClientData(clientDataID, size, flags DWord) error { 361 | // SimConnect_CreateClientData( 362 | // HANDLE hSimConnect, 363 | // SIMCONNECT_CLIENT_DATA_ID ClientDataID, 364 | // DWORD dwSize, 365 | // SIMCONNECT_CREATE_CLIENT_DATA_FLAG Flags) 366 | 367 | args := []uintptr{ 368 | uintptr(simco.handle), 369 | uintptr(clientDataID), 370 | uintptr(size), 371 | uintptr(flags), 372 | } 373 | return callProc(scCreateClientData, args...) 374 | } 375 | 376 | // SimConnect_AddToClientDataDefinition: Used to add an offset and a size in bytes, or a type, to a client data definition. 377 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_AddToClientDataDefinition.htm 378 | func (simco *SimConnect) AddToClientDataDefinition(defineID, offset, sizeOrType DWord) error { 379 | // SimConnect_AddToClientDataDefinition( 380 | // HANDLE hSimConnect, 381 | // SIMCONNECT_CLIENT_DATA_DEFINITION_ID DefineID, 382 | // DWORD dwOffset, 383 | // DWORD dwSizeOrType, 384 | // float fEpsilon = 0, 385 | // DWORD DatumID = SIMCONNECT_UNUSED) 386 | 387 | const epsilon float32 = 0 388 | const datumID = Unused 389 | 390 | args := []uintptr{ 391 | uintptr(simco.handle), 392 | uintptr(defineID), 393 | uintptr(offset), 394 | uintptr(sizeOrType), 395 | uintptr(epsilon), 396 | uintptr(datumID), 397 | } 398 | return callProc(scAddToClientDataDefinition, args...) 399 | } 400 | 401 | // SimConnect_AddToDataDefinition: Used to add a Flight Simulator simulation variable name to a client defined object definition. 402 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_AddToDataDefinition.htm 403 | func (simco *SimConnect) AddToDataDefinition(defineID DWord, datumName string, unitName string, datumType DWord) error { 404 | // SimConnect_AddToDataDefinition( 405 | // HANDLE hSimConnect, 406 | // SIMCONNECT_DATA_DEFINITION_ID DefineID, 407 | // const char * DatumName, 408 | // const char * UnitsName, 409 | // SIMCONNECT_DATATYPE DatumType = SIMCONNECT_DATATYPE_FLOAT64, 410 | // float fEpsilon = 0, 411 | // DWORD DatumID = SIMCONNECT_UNUSED) 412 | 413 | var unitArg uintptr = 0 414 | if len(unitName) > 0 { 415 | unitArg = toCharPtr(unitName) 416 | } 417 | 418 | const epsilon float32 = 0 419 | const datumID = Unused 420 | 421 | args := []uintptr{ 422 | uintptr(simco.handle), 423 | uintptr(defineID), 424 | toCharPtr(datumName), 425 | unitArg, 426 | uintptr(datumType), 427 | uintptr(epsilon), 428 | uintptr(datumID), 429 | } 430 | return callProc(scAddToDataDefinition, args...) 431 | } 432 | 433 | // SimConnect_SetClientData: Used to write one or more units of data to a client data area. 434 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_SetClientData.htm 435 | func (simco *SimConnect) SetClientData(clientDataID, defineID, flags DWord, unitSize DWord, buf unsafe.Pointer) error { 436 | // SimConnect_SetClientData( 437 | // HANDLE hSimConnect, 438 | // SIMCONNECT_CLIENT_DATA_ID ClientDataID, 439 | // SIMCONNECT_CLIENT_DATA_DEFINITION_ID DefineID, 440 | // SIMCONNECT_CLIENT_DATA_SET_FLAG Flags, 441 | // DWORD dwReserved, 442 | // DWORD cbUnitSize, 443 | // void * pDataSet) 444 | 445 | const reserved DWord = 0 446 | args := []uintptr{ 447 | uintptr(simco.handle), 448 | uintptr(clientDataID), 449 | uintptr(defineID), 450 | uintptr(flags), 451 | uintptr(reserved), 452 | uintptr(unitSize), 453 | uintptr(buf), 454 | } 455 | return callProc(scSetClientData, args...) 456 | 457 | } 458 | 459 | // SimConnect_SetDataOnSimObject: Used to make changes to the data properties of an object. 460 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_SetDataOnSimObject.htm 461 | func (simco *SimConnect) SetDataOnSimObject(defineID, objectID, flags, arrayCount, unitSize DWord, buf unsafe.Pointer) error { 462 | // SimConnect_SetDataOnSimObject( 463 | // HANDLE hSimConnect, 464 | // SIMCONNECT_DATA_DEFINITION_ID DefineID, 465 | // SIMCONNECT_OBJECT_ID ObjectID, 466 | // SIMCONNECT_DATA_SET_FLAG Flags, 467 | // DWORD ArrayCount, 468 | // DWORD cbUnitSize, 469 | // void * pDataSet) 470 | 471 | args := []uintptr{ 472 | uintptr(simco.handle), 473 | uintptr(defineID), 474 | uintptr(objectID), 475 | uintptr(flags), 476 | uintptr(arrayCount), 477 | uintptr(unitSize), 478 | uintptr(buf), 479 | } 480 | return callProc(scSetDataOnSimObject, args...) 481 | } 482 | 483 | // SimConnect_ClearClientDataDefinition: Used to clear the definition of the specified client data. 484 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_ClearClientDataDefinition.htm 485 | func (simco *SimConnect) ClearClientDataDefinition(defineID DWord) error { 486 | // SimConnect_ClearClientDataDefinition( 487 | // HANDLE hSimConnect, 488 | // SIMCONNECT_CLIENT_DATA_DEFINITION_ID DefineID) 489 | 490 | args := []uintptr{ 491 | uintptr(simco.handle), 492 | uintptr(defineID), 493 | } 494 | return callProc(scClearClientDataDefinition, args...) 495 | } 496 | 497 | // SimConnect_ClearDataDefinition: Used to remove all simulation variables from a client defined object. 498 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_ClearDataDefinition.htm 499 | func (simco *SimConnect) ClearDataDefinition(defineID DWord) error { 500 | // SIMCONNECTAPI SimConnect_ClearDataDefinition( 501 | // HANDLE hSimConnect, 502 | // SIMCONNECT_DATA_DEFINITION_ID DefineID) 503 | 504 | args := []uintptr{ 505 | uintptr(simco.handle), 506 | uintptr(defineID), 507 | } 508 | return callProc(scClearDataDefinition, args...) 509 | } 510 | 511 | // SimConnect_MapInputEventToClientEvent: Used to connect input events (such as keystrokes, joystick or mouse movements) with the sending of appropriate event notifications. 512 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_MapInputEventToClientEvent.htm 513 | func (simco *SimConnect) MapInputEventToClientEvent(groupID DWord, inputDefinition string, downEventID DWord) error { 514 | // SimConnect_MapInputEventToClientEvent( 515 | // HANDLE hSimConnect, 516 | // SIMCONNECT_INPUT_GROUP_ID GroupID, 517 | // const char * szInputDefinition, 518 | // SIMCONNECT_CLIENT_EVENT_ID DownEventID, 519 | // DWORD DownValue = 0, 520 | // SIMCONNECT_CLIENT_EVENT_ID UpEventID = (SIMCONNECT_CLIENT_EVENT_ID)SIMCONNECT_UNUSED, 521 | // DWORD UpValue = 0, 522 | // BOOL bMaskable = FALSE) 523 | 524 | const downValue DWord = 0 525 | const upEventID = Unused 526 | const upValue DWord = 0 527 | const maskable = false 528 | 529 | args := []uintptr{ 530 | uintptr(simco.handle), 531 | uintptr(groupID), 532 | toCharPtr(inputDefinition), 533 | uintptr(downEventID), 534 | uintptr(downValue), 535 | uintptr(upEventID), 536 | uintptr(upValue), 537 | toBoolPtr(maskable), 538 | } 539 | return callProc(scMapInputEventToClientEvent, args...) 540 | } 541 | 542 | // SimConnect_RequestNotificationGroup: Used to request events from a notification group when the simulation is in Dialog Mode. 543 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_RequestNotificationGroup.htm 544 | func (simco *SimConnect) RequestNotificationGroup(groupID DWord) error { 545 | // SimConnect_RequestNotificationGroup( 546 | // HANDLE hSimConnect, 547 | // SIMCONNECT_NOTIFICATION_GROUP_ID GroupID, 548 | // DWORD dwReserved = 0, 549 | // DWORD Flags = 0) 550 | 551 | const reserved DWord = 0 552 | const flags DWord = 0 553 | 554 | args := []uintptr{ 555 | uintptr(simco.handle), 556 | uintptr(groupID), 557 | uintptr(reserved), 558 | uintptr(flags), 559 | } 560 | return callProc(scRequestNotificationGroup, args...) 561 | } 562 | 563 | // SimConnect_ClearInputGroup: Used to remove all the input events from a specified input group object. 564 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_ClearInputGroup.htm 565 | func (simco *SimConnect) ClearInputGroup(groupID DWord) error { 566 | // SimConnect_ClearInputGroup( 567 | // HANDLE hSimConnect, 568 | // SIMCONNECT_INPUT_GROUP_ID GroupID) 569 | 570 | args := []uintptr{ 571 | uintptr(simco.handle), 572 | uintptr(groupID), 573 | } 574 | return callProc(scClearInputGroup, args...) 575 | } 576 | 577 | // SimConnect_ClearNotificationGroup: Used to remove all the client defined events from a notification group. 578 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_ClearNotificationGroup.htm 579 | func (simco *SimConnect) ClearNotificationGroup(groupID DWord) error { 580 | // SimConnect_ClearNotificationGroup( 581 | // HANDLE hSimConnect, 582 | // SIMCONNECT_NOTIFICATION_GROUP_ID GroupID) 583 | 584 | args := []uintptr{ 585 | uintptr(simco.handle), 586 | uintptr(groupID), 587 | } 588 | return callProc(scClearNotificationGroup, args...) 589 | } 590 | 591 | // SimConnect_RequestReservedKey: Used to request a specific keyboard TAB-key combination applies only to this client. 592 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_RequestReservedKey.htm 593 | // func (simco *SimConnect) RequestReservedKey(eventID uint32, keyChoice1, keyChoice2, keyChoice3 string) error { 594 | // // SimConnect_RequestReservedKey( 595 | // // HANDLE hSimConnect, 596 | // // SIMCONNECT_CLIENT_EVENT_ID EventID, 597 | // // const char * szKeyChoice1 = "", 598 | // // const char * szKeyChoice2 = "", 599 | // // const char * szKeyChoice3 = "") 600 | // return errors.New("Not implemented") 601 | // } 602 | 603 | // SimConnect_SetInputGroupPriority: Used to set the priority for a specified input group object. 604 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_SetInputGroupPriority.htm 605 | func (simco *SimConnect) SetInputGroupPriority(groupID, priority DWord) error { 606 | // SimConnect_SetInputGroupPriority( 607 | // HANDLE hSimConnect, 608 | // SIMCONNECT_INPUT_GROUP_ID GroupID, 609 | // DWORD uPriority) 610 | 611 | args := []uintptr{ 612 | uintptr(simco.handle), 613 | uintptr(groupID), 614 | uintptr(priority), 615 | } 616 | return callProc(scSetInputGroupPriority, args...) 617 | } 618 | 619 | // SimConnect_SetInputGroupState: Used to turn requests for input event information from the server on and off. 620 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_SetInputGroupState.htm 621 | func (simco *SimConnect) SetInputGroupState(groupID, state DWord) error { 622 | // SimConnect_SetInputGroupState( 623 | // HANDLE hSimConnect, 624 | // SIMCONNECT_INPUT_GROUP_ID GroupID, 625 | // DWORD dwState) 626 | 627 | args := []uintptr{ 628 | uintptr(simco.handle), 629 | uintptr(groupID), 630 | uintptr(state), 631 | } 632 | return callProc(scSetInputGroupState, args...) 633 | } 634 | 635 | // SimConnect_RemoveInputEvent: Used to remove an input event from a specified input group object. 636 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Events_And_Data/SimConnect_RemoveInputEvent.htm 637 | func (simco *SimConnect) RemoveInputEvent(groupID DWord, inputDefinition string) error { 638 | // SimConnect_RemoveInputEvent( 639 | // HANDLE hSimConnect, 640 | // SIMCONNECT_INPUT_GROUP_ID GroupID, 641 | // const char * szInputDefinition) 642 | 643 | args := []uintptr{ 644 | uintptr(simco.handle), 645 | uintptr(groupID), 646 | toCharPtr(inputDefinition), 647 | } 648 | return callProc(scRemoveInputEvent, args...) 649 | } 650 | 651 | // AI Object functions: 652 | 653 | // SimConnect_AICreateEnrouteATCAircraft: Used to create an AI controlled aircraft that is about to start or is already underway on its flight plan. 654 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/AI_Object/SimConnect_AICreateEnrouteATCAircraft.htm 655 | func (simco *SimConnect) AICreateEnrouteATCAircraft(containerTitle, tailNumber string, flightNumber int, flightPlanPath string, flightPlanPosition float64, touchAndGo bool, requestID uint32) error { 656 | // SimConnect_AICreateEnrouteATCAircraft( 657 | // HANDLE hSimConnect, 658 | // const char * szContainerTitle, 659 | // const char * szTailNumber, 660 | // int iFlightNumber, 661 | // const char * szFlightPlanPath, 662 | // double dFlightPlanPosition, 663 | // BOOL bTouchAndGo, 664 | // SIMCONNECT_DATA_REQUEST_ID RequestID) 665 | 666 | args := []uintptr{ 667 | uintptr(simco.handle), 668 | uintptr(toCharPtr(containerTitle)), 669 | uintptr(toCharPtr(tailNumber)), 670 | uintptr(flightNumber), 671 | uintptr(toCharPtr(flightPlanPath)), 672 | uintptr(flightPlanPosition), 673 | uintptr(toBoolPtr(touchAndGo)), 674 | uintptr(requestID), 675 | } 676 | return callProc(scAICreateEnrouteATCAircraft, args...) 677 | } 678 | 679 | // SimConnect_AICreateNonATCAircraft: Used to create an aircraft that is not flying under ATC control (so is typically flying under VFR rules). 680 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/AI_Object/SimConnect_AICreateNonATCAircraft.htm 681 | func (simco *SimConnect) AICreateNonATCAircraft(containerTitle, tailNumber string, initPos InitPosition, requestID DWord) error { 682 | // SimConnect_AICreateNonATCAircraft( 683 | // HANDLE hSimConnect, 684 | // const char * szContainerTitle, 685 | // const char * szTailNumber, 686 | // SIMCONNECT_DATA_INITPOSITION InitPos, 687 | // SIMCONNECT_DATA_REQUEST_ID RequestID) 688 | 689 | args := []uintptr{ 690 | uintptr(simco.handle), 691 | uintptr(toCharPtr(containerTitle)), 692 | uintptr(toCharPtr(tailNumber)), 693 | uintptr(unsafe.Pointer(&initPos)), 694 | uintptr(requestID), 695 | } 696 | return callProc(scAICreateNonATCAircraft, args...) 697 | } 698 | 699 | // SimConnect_AICreateParkedATCAircraft: Used to create an AI controlled aircraft that is currently parked and does not have a flight plan. 700 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/AI_Object/SimConnect_AICreateParkedATCAircraft.htm 701 | func (simco *SimConnect) AICreateParkedATCAircraft(containerTitle, tailNumber, airportID string, requestID DWord) error { 702 | // TODO: SimConnect_AICreateParkedATCAircraft( 703 | // HANDLE hSimConnect, 704 | // const char * szContainerTitle, 705 | // const char * szTailNumber, 706 | // const char * szAirportID, 707 | // SIMCONNECT_DATA_REQUEST_ID RequestID) 708 | 709 | args := []uintptr{ 710 | uintptr(simco.handle), 711 | uintptr(toCharPtr(containerTitle)), 712 | uintptr(toCharPtr(tailNumber)), 713 | uintptr(toCharPtr(airportID)), 714 | uintptr(requestID), 715 | } 716 | return callProc(scAICreateParkedATCAircraft, args...) 717 | } 718 | 719 | // SimConnect_AICreateSimulatedObject: Used to create AI controlled objects other than aircraft. 720 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/AI_Object/SimConnect_AICreateSimulatedObject.htm 721 | func (simco *SimConnect) AICreateSimulatedObject(containerTitle string, initPos InitPosition, requestID DWord) error { 722 | // SimConnect_AICreateSimulatedObject( 723 | // HANDLE hSimConnect, 724 | // const char * szContainerTitle, 725 | // SIMCONNECT_DATA_INITPOSITION InitPos, 726 | // SIMCONNECT_DATA_REQUEST_ID RequestID) 727 | 728 | args := []uintptr{ 729 | uintptr(simco.handle), 730 | uintptr(toCharPtr(containerTitle)), 731 | uintptr(unsafe.Pointer(&initPos)), 732 | uintptr(requestID), 733 | } 734 | return callProc(scAICreateSimulatedObject, args...) 735 | } 736 | 737 | // SimConnect_AIReleaseControl: Used to clear the AI control of a simulated object, typically an aircraft, in order for it to be controlled by a SimConnect client. 738 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/AI_Object/SimConnect_AIReleaseControl.htm 739 | func (simco *SimConnect) AIReleaseControl(objectID, requestID DWord) error { 740 | // SimConnect_AIReleaseControl( 741 | // HANDLE hSimConnect, 742 | // SIMCONNECT_OBJECT_ID ObjectID, 743 | // SIMCONNECT_DATA_REQUEST_ID RequestID) 744 | 745 | args := []uintptr{ 746 | uintptr(simco.handle), 747 | uintptr(objectID), 748 | uintptr(requestID), 749 | } 750 | return callProc(scAIReleaseControl, args...) 751 | } 752 | 753 | // SimConnect_AIRemoveObject: Used to remove any object created by the client using one of the AI creation functions. 754 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/AI_Object/SimConnect_AIRemoveObject.htm 755 | func (simco *SimConnect) AIRemoveObject(objectID, requestID DWord) error { 756 | // SimConnect_AIRemoveObject( 757 | // HANDLE hSimConnect, 758 | // SIMCONNECT_OBJECT_ID ObjectID, 759 | // SIMCONNECT_DATA_REQUEST_ID RequestID) 760 | 761 | args := []uintptr{ 762 | uintptr(simco.handle), 763 | uintptr(objectID), 764 | uintptr(requestID), 765 | } 766 | return callProc(scAIRemoveObject, args...) 767 | } 768 | 769 | // SimConnect_AISetAircraftFlightPlan: Used to set or change the flight plan of an AI controlled aircraft. 770 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/AI_Object/SimConnect_AISetAircraftFlightPlan.htm 771 | func (simco *SimConnect) AISetAircraftFlightPlan(objectID, requestID DWord, flightPlanPath string) error { 772 | // SimConnect_AISetAircraftFlightPlan( 773 | // HANDLE hSimConnect, 774 | // SIMCONNECT_OBJECT_ID ObjectID, 775 | // const char * szFlightPlanPath, 776 | // SIMCONNECT_DATA_REQUEST_ID RequestID) 777 | 778 | args := []uintptr{ 779 | uintptr(simco.handle), 780 | uintptr(objectID), 781 | uintptr(toCharPtr(flightPlanPath)), 782 | uintptr(requestID), 783 | } 784 | return callProc(scAISetAircraftFlightPlan, args...) 785 | } 786 | 787 | // Flights functions: 788 | 789 | // SimConnect_FlightLoad: Used to load an existing flight file. 790 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Flights/SimConnect_FlightLoad.htm 791 | func (simco *SimConnect) FlightLoad(fileName string) error { 792 | // SimConnect_FlightLoad( 793 | // HANDLE hSimConnect, 794 | // const char * szFileName) 795 | 796 | args := []uintptr{ 797 | uintptr(simco.handle), 798 | uintptr(toCharPtr(fileName)), 799 | } 800 | return callProc(scFlightLoad, args...) 801 | } 802 | 803 | // SimConnect_FlightSave: Used to save the current state of a flight to a flight file. 804 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Flights/SimConnect_FlightSave.htm 805 | func (simco *SimConnect) FlightSave(fileName, title, description string, flags DWord) error { 806 | // SimConnect_FlightSave( 807 | // HANDLE hSimConnect, 808 | // const char * szFileName, 809 | // const char * szTitle, 810 | // const char * szDescription, 811 | // DWORD Flags) 812 | 813 | args := []uintptr{ 814 | uintptr(simco.handle), 815 | uintptr(toCharPtr(fileName)), 816 | uintptr(toCharPtr(title)), 817 | uintptr(toCharPtr(description)), 818 | uintptr(flags), 819 | } 820 | return callProc(scFlightSave, args...) 821 | } 822 | 823 | // SimConnect_FlightPlanLoad: Used to load an existing flight plan. 824 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Flights/SimConnect_FlightPlanLoad.htm 825 | // (fileName: .PLN file format, no extension) 826 | func (simco *SimConnect) FlightPlanLoad(fileName string) error { 827 | // SimConnect_FlightPlanLoad( 828 | // HANDLE hSimConnect, 829 | // const char * szFileName) 830 | 831 | args := []uintptr{ 832 | uintptr(simco.handle), 833 | uintptr(toCharPtr(fileName)), 834 | } 835 | return callProc(scFlightPlanLoad, args...) 836 | } 837 | 838 | // Debug functions: 839 | 840 | // SimConnect_GetLastSentPacketID: Returns the ID of the last packet sent to the SimConnect server. 841 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Debug/SimConnect_GetLastSentPacketID.htm 842 | func (simco *SimConnect) GetLastSentPacketID(pdwError *DWord) error { 843 | // SimConnect_GetLastSentPacketID( 844 | // HANDLE hSimConnect, 845 | // DWORD * pdwError); 846 | 847 | args := []uintptr{ 848 | uintptr(simco.handle), 849 | uintptr(unsafe.Pointer(pdwError)), 850 | } 851 | return callProc(scGetLastSentPacketID, args...) 852 | } 853 | 854 | // SimConnect_RequestResponseTimes: Used to provide some data on the performance of the client-server connection. 855 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Debug/SimConnect_RequestResponseTimes.htm 856 | // TODO: SimConnect_RequestResponseTimes(HANDLE hSimConnect, DWORD nCount, float * fElapsedSeconds) 857 | 858 | // SimConnect_InsertString: Used to assist in adding variable length strings to a structure. 859 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Debug/SimConnect_InsertString.htm 860 | // TODO: SimConnect_InsertString(char * pDest, DWORD cbDest, void ** ppEnd, DWORD * pcbStringV, const char * pSource) 861 | 862 | // SimConnect_RetrieveString: Used to assist in retrieving variable length strings from a structure. 863 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Debug/SimConnect_RetrieveString.htm 864 | // TODO: SimConnect_RetrieveString(SIMCONNECT_RECV * pData, DWORD cbData, void * pStringV, char ** pszString, DWORD * pcbString) 865 | 866 | // Facilities functions: 867 | 868 | // SimConnect_RequestFacilitesList: Request a list of all the facilities of a given type currently held in the facilities cache. 869 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Facilities/SimConnect_RequestFacilitesList.htm 870 | func (simco *SimConnect) RequestFacilitiesList(facilityListType, requestID DWord) error { 871 | // SimConnect_RequestFacilitiesList( 872 | // HANDLE hSimConnect, 873 | // SIMCONNECT_FACILITY_LIST_TYPE type, 874 | // SIMCONNECT_DATA_REQUEST_ID RequestID) 875 | 876 | args := []uintptr{ 877 | uintptr(simco.handle), 878 | uintptr(facilityListType), 879 | uintptr(requestID), 880 | } 881 | return callProc(scRequestFacilitiesList, args...) 882 | } 883 | 884 | // SimConnect_SubscribeToFacilities: Used to request notifications when a facility of a certain type is added to the facilities cache. 885 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Facilities/SimConnect_SubscribeToFacilities.htm 886 | func (simco *SimConnect) SubscribeToFacilities(facilityListType, requestID DWord) error { 887 | // SimConnect_SubscribeToFacilities( 888 | // HANDLE hSimConnect, 889 | // SIMCONNECT_FACILITY_LIST_TYPE type, 890 | // SIMCONNECT_DATA_REQUEST_ID RequestID) 891 | 892 | args := []uintptr{ 893 | uintptr(simco.handle), 894 | uintptr(facilityListType), 895 | uintptr(requestID), 896 | } 897 | return callProc(scSubscribeToFacilities, args...) 898 | } 899 | 900 | // SimConnect_UnsubscribeToFacilities: Used to request that notifications of additions to the facilities cache are not longer sent. 901 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Facilities/SimConnect_UnsubscribeToFacilities.htm 902 | func (simco *SimConnect) UnsubscribeToFacilities(facilityListType DWord) error { 903 | // SimConnect_UnsubscribeToFacilities( 904 | // HANDLE hSimConnect, 905 | // SIMCONNECT_FACILITY_LIST_TYPE type) 906 | 907 | args := []uintptr{ 908 | uintptr(simco.handle), 909 | uintptr(facilityListType), 910 | } 911 | return callProc(scUnsubscribeToFacilities, args...) 912 | } 913 | 914 | // Mission functions: 915 | // see https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/SimConnect_API_Reference.htm 916 | 917 | // TODO: SimConnect_CompleteCustomMissionAction(HANDLE hSimConnect, const GUID guidInstanceId) 918 | // TODO: SimConnect_ExecuteMissionAction(HANDLE hSimConnect, const GUID guidInstanceId) 919 | 920 | // Menu functions: 921 | 922 | // SimConnect_MenuAddItem is mentioned in the docs but there is no further description 923 | // see https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/SimConnect_API_Reference.htm 924 | func (simco *SimConnect) MenuAddItem(menuItem string, menuEventID, data DWord) error { 925 | // SimConnect_MenuAddItem( 926 | // HANDLE hSimConnect, 927 | // const char * szMenuItem, 928 | // SIMCONNECT_CLIENT_EVENT_ID MenuEventID, 929 | // DWORD dwData) 930 | 931 | args := []uintptr{ 932 | uintptr(simco.handle), 933 | uintptr(toCharPtr(menuItem)), 934 | uintptr(eventID), 935 | uintptr(data), 936 | } 937 | return callProc(scMenuAddItem, args...) 938 | } 939 | 940 | // SimConnect_MenuAddSubItem is mentioned in the docs but there is no further description 941 | // see https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/SimConnect_API_Reference.htm 942 | func (simco *SimConnect) MenuAddSubItem(menuEventID DWord, menuItem string, subMenuEventID, data DWord) error { 943 | // SimConnect_MenuAddSubItem( 944 | // HANDLE hSimConnect, 945 | // SIMCONNECT_CLIENT_EVENT_ID MenuEventID, 946 | // const char * szMenuItem, 947 | // SIMCONNECT_CLIENT_EVENT_ID SubMenuEventID, 948 | // DWORD dwData) 949 | 950 | args := []uintptr{ 951 | uintptr(simco.handle), 952 | uintptr(menuEventID), 953 | uintptr(toCharPtr(menuItem)), 954 | uintptr(subMenuEventID), 955 | uintptr(data), 956 | } 957 | return callProc(scMenuAddSubItem, args...) 958 | } 959 | 960 | // SimConnect_MenuDeleteItem is mentioned in the docs but there is no further description 961 | // see https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/SimConnect_API_Reference.htm 962 | func (simco *SimConnect) MenuDeleteItem(menuEventID DWord) error { 963 | // SimConnect_MenuDeleteItem( 964 | // HANDLE hSimConnect, 965 | // SIMCONNECT_CLIENT_EVENT_ID MenuEventID) 966 | 967 | args := []uintptr{ 968 | uintptr(simco.handle), 969 | uintptr(menuEventID), 970 | } 971 | return callProc(scMenuDeleteItem, args...) 972 | } 973 | 974 | // SimConnect_MenuDeleteSubItem is mentioned in the docs but there is no further description 975 | // see https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/SimConnect_API_Reference.htm 976 | func (simco *SimConnect) MenuDeleteSubItem(menuEventID, subMenuEventID DWord) error { 977 | // SimConnect_MenuDeleteSubItem( 978 | // HANDLE hSimConnect, 979 | // SIMCONNECT_CLIENT_EVENT_ID MenuEventID, 980 | // const SIMCONNECT_CLIENT_EVENT_ID SubMenuEventID) 981 | 982 | args := []uintptr{ 983 | uintptr(simco.handle), 984 | uintptr(menuEventID), 985 | uintptr(subMenuEventID), 986 | } 987 | return callProc(scMenuDeleteSubItem, args...) 988 | } 989 | 990 | // SimConnect_CameraSetRelative6DOF is not documented (see SimConnect.h) 991 | func (simco *SimConnect) CameraSetRelative6DOF(deltaX, deltaY, deltaZ, pitchDeg, bankDeg, headingDeg float64) error { 992 | // SimConnect_CameraSetRelative6DOF( 993 | // HANDLE hSimConnect, 994 | // float fDeltaX, 995 | // float fDeltaY, 996 | // float fDeltaZ, 997 | // float fPitchDeg, 998 | // float fBankDeg, 999 | // float fHeadingDeg) 1000 | 1001 | args := []uintptr{ 1002 | uintptr(simco.handle), 1003 | uintptr(deltaX), 1004 | uintptr(deltaY), 1005 | uintptr(deltaZ), 1006 | uintptr(pitchDeg), 1007 | uintptr(bankDeg), 1008 | uintptr(headingDeg), 1009 | } 1010 | return callProc(scCameraSetRelative6DOF, args...) 1011 | } 1012 | 1013 | // SimConnect_SetSystemState is not documented (see SimConnect.h) 1014 | func (simco *SimConnect) SetSystemState(state string, integerValue DWord, floatValue float32, stringValue string) error { 1015 | // SimConnect_SetSystemState( 1016 | // HANDLE hSimConnect, 1017 | // const char * szState, 1018 | // DWORD dwInteger, 1019 | // float fFloat, 1020 | // const char * szString) 1021 | 1022 | args := []uintptr{ 1023 | uintptr(simco.handle), 1024 | uintptr(toCharPtr(state)), 1025 | uintptr(integerValue), 1026 | uintptr(floatValue), 1027 | uintptr(toCharPtr(stringValue)), 1028 | } 1029 | return callProc(scSetSystemState, args...) 1030 | } 1031 | -------------------------------------------------------------------------------- /simconnect/defs.go: -------------------------------------------------------------------------------- 1 | package simconnect 2 | 3 | import ( 4 | "math" 5 | ) 6 | 7 | /* 8 | Transfused code from: SimConnect.h 9 | Location: /MSFS SDK/SimConnect SDK/include 10 | Copyright (c) Microsoft Corporation. All Rights Reserved. 11 | 12 | Please also check out the official documentation: 13 | https://docs.flightsimulator.com/html/index.htm 14 | */ 15 | 16 | const ( 17 | // General 18 | scOpen = "SimConnect_Open" 19 | scClose = "SimConnect_Close" 20 | scCallDispatch = "SimConnect_CallDispatch" // Not implemented 21 | scGetNextDispatch = "SimConnect_GetNextDispatch" 22 | scRequestSystemState = "SimConnect_RequestSystemState" 23 | scMapClientEventToSimEvent = "SimConnect_MapClientEventToSimEvent" 24 | scSubscribeToSystemEvent = "SimConnect_SubscribeToSystemEvent" 25 | scSetSystemEventState = "SimConnect_SetSystemEventState" 26 | scUnsubscribeFromSystemEvent = "SimConnect_UnsubscribeFromSystemEvent" 27 | scSetNotificationGroupPriority = "SimConnect_SetNotificationGroupPriority" 28 | scText = "SimConnect_Text" 29 | // Events and Data 30 | scRequestDataOnSimObject = "SimConnect_RequestDataOnSimObject" 31 | scRequestDataOnSimObjectType = "SimConnect_RequestDataOnSimObjectType" 32 | scAddClientEventToNotificationGroup = "SimConnect_AddClientEventToNotificationGroup" 33 | scRemoveClientEvent = "SimConnect_RemoveClientEvent" 34 | scTransmitClientEvent = "SimConnect_TransmitClientEvent" 35 | scMapClientDataNameToID = "SimConnect_MapClientDataNameToID" 36 | scRequestClientData = "SimConnect_RequestClientData" 37 | scCreateClientData = "SimConnect_CreateClientData" 38 | scAddToClientDataDefinition = "SimConnect_AddToClientDataDefinition" 39 | scAddToDataDefinition = "SimConnect_AddToDataDefinition" 40 | scSetClientData = "SimConnect_SetClientData" 41 | scSetDataOnSimObject = "SimConnect_SetDataOnSimObject" 42 | scClearClientDataDefinition = "SimConnect_ClearClientDataDefinition" 43 | scClearDataDefinition = "SimConnect_ClearDataDefinition" 44 | scMapInputEventToClientEvent = "SimConnect_MapInputEventToClientEvent" 45 | scRequestNotificationGroup = "SimConnect_RequestNotificationGroup" 46 | scClearInputGroup = "SimConnect_ClearInputGroup" 47 | scClearNotificationGroup = "SimConnect_ClearNotificationGroup" 48 | scRequestReservedKey = "SimConnect_RequestReservedKey" // Not implemented 49 | scSetInputGroupPriority = "SimConnect_SetInputGroupPriority" 50 | scSetInputGroupState = "SimConnect_SetInputGroupState" 51 | scRemoveInputEvent = "SimConnect_RemoveInputEvent" 52 | // AI Objects 53 | scAICreateEnrouteATCAircraft = "SimConnect_AICreateEnrouteATCAircraft" 54 | scAICreateNonATCAircraft = "SimConnect_AICreateNonATCAircraft" 55 | scAICreateParkedATCAircraft = "SimConnect_AICreateParkedATCAircraft" 56 | scAICreateSimulatedObject = "SimConnect_AICreateSimulatedObject" 57 | scAIReleaseControl = "SimConnect_AIReleaseControl" 58 | scAIRemoveObject = "SimConnect_AIRemoveObject" 59 | scAISetAircraftFlightPlan = "SimConnect_AISetAircraftFlightPlan" 60 | // Flights 61 | scFlightLoad = "SimConnect_FlightLoad" 62 | scFlightSave = "SimConnect_FlightSave" 63 | scFlightPlanLoad = "SimConnect_FlightPlanLoad" 64 | // Debug 65 | scGetLastSentPacketID = "SimConnect_GetLastSentPacketID" 66 | scRequestResponseTimes = "SimConnect_RequestResponseTimes" // Not implemented 67 | scInsertString = "SimConnect_InsertString" // Not implemented 68 | scRetrieveString = "SimConnect_RetrieveString" // Not implemented 69 | // Facilities 70 | scRequestFacilitiesList = "SimConnect_RequestFacilitiesList" 71 | scSubscribeToFacilities = "SimConnect_SubscribeToFacilities" 72 | scUnsubscribeToFacilities = "SimConnect_UnsubscribeToFacilities" 73 | // Missions 74 | // scCompleteCustomMissionAction = "SimConnect_CompleteCustomMissionAction" // Not implemented 75 | // scExecuteMissionAction = "SimConnect_ExecuteMissionAction" // Not implemented 76 | // Menu 77 | scMenuAddItem = "SimConnect_MenuAddItem" 78 | scMenuAddSubItem = "SimConnect_MenuAddSubItem" 79 | scMenuDeleteItem = "SimConnect_MenuDeleteItem" 80 | scMenuDeleteSubItem = "SimConnect_MenuDeleteSubItem" 81 | // Undocumented 82 | scCameraSetRelative6DOF = "SimConnect_CameraSetRelative6DOF" 83 | scSetSystemState = "SimConnect_SetSystemState" 84 | ) 85 | 86 | type DWord uint32 // DWORD 87 | 88 | const ( 89 | DWordMax DWord = 0xffffffff // DWORD_MAX 90 | EFail uint32 = 0x80004005 // E_FAIL 91 | Unused DWord = DWordMax // SIMCONNECT_UNUSED 92 | ObjectIDUser DWord = 0 // SIMCONNECT_OBJECT_ID_USER 93 | CameraIgnoreField float32 = math.MaxFloat32 // SIMCONNECT_CAMERA_IGNORE_FIELD: Used to tell the Camera API to NOT modify the value in this part of the argument. 94 | ClientDataMaxSize DWord = 8192 // SIMCONNECT_CLIENTDATA_MAX_SIZE: maximum value for SimConnect_CreateClientData dwSize parameter 95 | WmUserSimConnect DWord = 0x0402 // WM_USER_SIMCONNECT 96 | DWordZero DWord = 0 97 | ) 98 | 99 | // Notification Group priority values 100 | const ( 101 | GroupPriorityHighest DWord = 1 // SIMCONNECT_GROUP_PRIORITY_HIGHEST: highest priority 102 | GroupPriorityHighestMaskable DWord = 10000000 // SIMCONNECT_GROUP_PRIORITY_HIGHEST_MASKABLE: highest priority that allows events to be masked 103 | GroupPriorityStandard DWord = 1900000000 // SIMCONNECT_GROUP_PRIORITY_STANDARD: standard priority 104 | GroupPriorityDefault DWord = 2000000000 // SIMCONNECT_GROUP_PRIORITY_DEFAULT: default priority 105 | GroupPriorityLowest DWord = 4000000000 // SIMCONNECT_GROUP_PRIORITY_LOWEST: priorities lower than this will be ignored 106 | ) 107 | 108 | // SIMCONNECT_RECV_ID: Receive data types 109 | const ( 110 | RecvIDNull = iota // SIMCONNECT_RECV_ID_NULL 111 | RecvIDException // SIMCONNECT_RECV_ID_EXCEPTION 112 | RecvIDOpen // SIMCONNECT_RECV_ID_OPEN 113 | RecvIDQuit // SIMCONNECT_RECV_ID_QUIT 114 | RecvIDEvent // SIMCONNECT_RECV_ID_EVENT 115 | RecvIDEventObjectAddRemove // SIMCONNECT_RECV_ID_EVENT_OBJECT_ADDREMOVE 116 | RecvIDEventFilename // SIMCONNECT_RECV_ID_EVENT_FILENAME 117 | RecvIDEventFrame // SIMCONNECT_RECV_ID_EVENT_FRAME 118 | RecvIDSimobjectData // SIMCONNECT_RECV_ID_SIMOBJECT_DATA 119 | RecvIDSimObjectDataByType // SIMCONNECT_RECV_ID_SIMOBJECT_DATA_BYTYPE 120 | RecvIDWeatherObservation // SIMCONNECT_RECV_ID_WEATHER_OBSERVATION 121 | RecvIDCloudState // SIMCONNECT_RECV_ID_CLOUD_STATE 122 | RecvIDAssignedObjectID // SIMCONNECT_RECV_ID_ASSIGNED_OBJECT_ID 123 | RecvIDReservedKey // SIMCONNECT_RECV_ID_RESERVED_KEY 124 | RecvIDCustomAction // SIMCONNECT_RECV_ID_CUSTOM_ACTION 125 | RecvIDSystemState // SIMCONNECT_RECV_ID_SYSTEM_STATE 126 | RecvIDClientData // SIMCONNECT_RECV_ID_CLIENT_DATA 127 | RecvIDEventWeatherMode // SIMCONNECT_RECV_ID_EVENT_WEATHER_MODE 128 | RecvIDAirportList // SIMCONNECT_RECV_ID_AIRPORT_LIST 129 | RecvIDVORList // SIMCONNECT_RECV_ID_VOR_LIST 130 | RecvIDNDBList // SIMCONNECT_RECV_ID_NDB_LIST 131 | RecvIDWaypointList // SIMCONNECT_RECV_ID_WAYPOINT_LIST 132 | RecvIDEventMultiplayerServerStarted // SIMCONNECT_RECV_ID_EVENT_MULTIPLAYER_SERVER_STARTED 133 | RecvIDEventMultiplayerClientStarted // SIMCONNECT_RECV_ID_EVENT_MULTIPLAYER_CLIENT_STARTED 134 | RecvIDEventMultiplayerSessionEnded // SIMCONNECT_RECV_ID_EVENT_MULTIPLAYER_SESSION_ENDED 135 | RecvIDEventRaceEnd // SIMCONNECT_RECV_ID_EVENT_RACE_END 136 | RecvIDEventRaceLap // SIMCONNECT_RECV_ID_EVENT_RACE_LAP 137 | RecvIDPick // SIMCONNECT_RECV_ID_PICK 138 | ) 139 | 140 | // SIMCONNECT_DATATYPE: Data data types 141 | const ( 142 | DataTypeInvalid = iota // SIMCONNECT_DATATYPE_INVALID 143 | DataTypeInt32 // SIMCONNECT_DATATYPE_INT32 144 | DataTypeInt64 // SIMCONNECT_DATATYPE_INT64 145 | DataTypeFloat32 // SIMCONNECT_DATATYPE_FLOAT32 146 | DataTypeFloat64 // SIMCONNECT_DATATYPE_FLOAT64 147 | DataTypeString8 // SIMCONNECT_DATATYPE_STRING8 148 | DataTypeString32 // SIMCONNECT_DATATYPE_STRING32 149 | DataTypeString64 // SIMCONNECT_DATATYPE_STRING64 150 | DataTypeString128 // SIMCONNECT_DATATYPE_STRING128 151 | DataTypeString256 // SIMCONNECT_DATATYPE_STRING256 152 | DataTypeString260 // SIMCONNECT_DATATYPE_STRING260 153 | DataTypeStringV // SIMCONNECT_DATATYPE_STRINGV 154 | DataTypeInitPosition // SIMCONNECT_DATATYPE_INITPOSITION 155 | DataTypeMarkerState // SIMCONNECT_DATATYPE_MARKERSTATE 156 | DataTypeWaypoint // SIMCONNECT_DATATYPE_WAYPOINT 157 | DataTypeLatLonAlt // SIMCONNECT_DATATYPE_LATLONALT 158 | DataTypeXYZ // SIMCONNECT_DATATYPE_XYZ 159 | ) 160 | 161 | // SIMCONNECT_EXCEPTION: Exception error types 162 | const ( 163 | ExceptionNone = iota // SIMCONNECT_EXCEPTION_NONE 164 | ExceptionError // SIMCONNECT_EXCEPTION_ERROR 165 | ExceptionSizeMismatch // SIMCONNECT_EXCEPTION_SIZE_MISMATCH 166 | ExceptionUnrecognizedID // SIMCONNECT_EXCEPTION_UNRECOGNIZED_ID 167 | ExceptionUnopened // SIMCONNECT_EXCEPTION_UNOPENED 168 | ExceptionVersionMismatch // SIMCONNECT_EXCEPTION_VERSION_MISMATCH 169 | ExceptionTooManyGroups // SIMCONNECT_EXCEPTION_TOO_MANY_GROUPS 170 | ExceptionNameUnrecognized // SIMCONNECT_EXCEPTION_NAME_UNRECOGNIZED 171 | ExceptionTooManyEventNames // SIMCONNECT_EXCEPTION_TOO_MANY_EVENT_NAMES 172 | ExceptionEventIDDuplicate // SIMCONNECT_EXCEPTION_EVENT_ID_DUPLICATE 173 | ExceptionTooManyMaps // SIMCONNECT_EXCEPTION_TOO_MANY_MAPS 174 | ExceptionTooManyObjects // SIMCONNECT_EXCEPTION_TOO_MANY_OBJECTS 175 | ExceptionTooManyRequests // SIMCONNECT_EXCEPTION_TOO_MANY_REQUESTS 176 | ExceptionWeatherInvalidPort // SIMCONNECT_EXCEPTION_WEATHER_INVALID_PORT 177 | ExceptionWeatherInvalidMetar // SIMCONNECT_EXCEPTION_WEATHER_INVALID_METAR 178 | ExceptionWeatherUnableToGetObservation // SIMCONNECT_EXCEPTION_WEATHER_UNABLE_TO_GET_OBSERVATION 179 | ExceptionWeatherUnableToCreateStation // SIMCONNECT_EXCEPTION_WEATHER_UNABLE_TO_CREATE_STATION 180 | ExceptionWeatherUnableToRemoveStation // SIMCONNECT_EXCEPTION_WEATHER_UNABLE_TO_REMOVE_STATION 181 | ExceptionInvalidDataType // SIMCONNECT_EXCEPTION_INVALID_DATA_TYPE 182 | ExceptionInvalidDataSize // SIMCONNECT_EXCEPTION_INVALID_DATA_SIZE 183 | ExceptionDataError // SIMCONNECT_EXCEPTION_DATA_ERROR 184 | ExceptionInvalidArray // SIMCONNECT_EXCEPTION_INVALID_ARRAY 185 | ExceptionCreateObjectFailed // SIMCONNECT_EXCEPTION_CREATE_OBJECT_FAILED 186 | ExceptionLoadFlightplanFailed // SIMCONNECT_EXCEPTION_LOAD_FLIGHTPLAN_FAILED 187 | ExceptionOperationInvalidForObjectType // SIMCONNECT_EXCEPTION_OPERATION_INVALID_FOR_OBJECT_TYPE 188 | ExceptionIllegalOperation // SIMCONNECT_EXCEPTION_ILLEGAL_OPERATION 189 | ExceptionAlreadySubscribed // SIMCONNECT_EXCEPTION_ALREADY_SUBSCRIBED 190 | ExceptionInvalidEnum // SIMCONNECT_EXCEPTION_INVALID_ENUM 191 | ExceptionDefinitionError // SIMCONNECT_EXCEPTION_DEFINITION_ERROR 192 | ExceptionDuplicateID // SIMCONNECT_EXCEPTION_DUPLICATE_ID 193 | ExceptionDatumID // SIMCONNECT_EXCEPTION_DATUM_ID 194 | ExceptionOutOfBounds // SIMCONNECT_EXCEPTION_OUT_OF_BOUNDS 195 | ExceptionAlreadyCreated // SIMCONNECT_EXCEPTION_ALREADY_CREATED 196 | ExceptionObjectOutsideRealityBubble // SIMCONNECT_EXCEPTION_OBJECT_OUTSIDE_REALITY_BUBBLE 197 | ExceptionObjectContainer // SIMCONNECT_EXCEPTION_OBJECT_CONTAINER 198 | ExceptionObjectAt // SIMCONNECT_EXCEPTION_OBJECT_AI 199 | ExceptionObjectATC // SIMCONNECT_EXCEPTION_OBJECT_ATC 200 | ExceptionObjectSchedule // SIMCONNECT_EXCEPTION_OBJECT_SCHEDULE 201 | ) 202 | 203 | // SIMCONNECT_SIMOBJECT_TYPE: Object types 204 | const ( 205 | SimObjectTypeUser DWord = iota // SIMCONNECT_SIMOBJECT_TYPE_USER 206 | SimObjectTypeAll // SIMCONNECT_SIMOBJECT_TYPE_ALL 207 | SimObjectTypeAircraft // SIMCONNECT_SIMOBJECT_TYPE_AIRCRAFT 208 | SimObjectTypeHelicopter // SIMCONNECT_SIMOBJECT_TYPE_HELICOPTER 209 | SimObjectTypeBoat // SIMCONNECT_SIMOBJECT_TYPE_BOAT 210 | SimObjectTypeGround // SIMCONNECT_SIMOBJECT_TYPE_GROUND 211 | ) 212 | 213 | // SIMCONNECT_STATE: EventState values 214 | const ( 215 | StateOff DWord = iota // SIMCONNECT_STATE_OFF 216 | StateOn // SIMCONNECT_STATE_ON 217 | ) 218 | 219 | // SIMCONNECT_PERIOD: Object Data Request Period values 220 | const ( 221 | PeriodNever DWord = iota // SIMCONNECT_PERIOD_NEVER 222 | PeriodOnce // SIMCONNECT_PERIOD_ONCE 223 | PeriodVisualFrame // SIMCONNECT_PERIOD_VISUAL_FRAME 224 | PeriodSimFrame // SIMCONNECT_PERIOD_SIM_FRAME 225 | PeriodSecond // SIMCONNECT_PERIOD_SECOND 226 | ) 227 | 228 | // SIMCONNECT_MISSION_END 229 | const ( 230 | MissionFailed DWord = iota // SIMCONNECT_MISSION_FAILED 231 | MissionCrashed // SIMCONNECT_MISSION_CRASHED 232 | MissionSucceeded // SIMCONNECT_MISSION_SUCCEEDED 233 | ) 234 | 235 | // SIMCONNECT_CLIENT_DATA_PERIOD: ClientData Request Period values 236 | // Used with the SimConnect_RequestClientData call to specify how often data is to be sent to the client. 237 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_CLIENT_DATA_PERIOD.htm 238 | const ( 239 | ClientDataPeriodNever DWord = iota // SIMCONNECT_CLIENT_DATA_PERIOD_NEVER 240 | ClientDataPeriodOnce // SIMCONNECT_CLIENT_DATA_PERIOD_ONCE 241 | ClientDataPeriodVisualFrame // SIMCONNECT_CLIENT_DATA_PERIOD_VISUAL_FRAME 242 | ClientDataPeriodOnSet // SIMCONNECT_CLIENT_DATA_PERIOD_ON_SET 243 | ClientDataPeriodSecond // SIMCONNECT_CLIENT_DATA_PERIOD_SECOND 244 | ) 245 | 246 | // SIMCONNECT_TEXT_TYPE 247 | // Used to specify which type of text is to be displayed by the SimConnect_Text function 248 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_TEXT_TYPE.htm 249 | const ( 250 | TextTypeScrollBlack DWord = iota // SIMCONNECT_TEXT_TYPE_SCROLL_BLACK DWord 251 | TextTypeScrollWhite // SIMCONNECT_TEXT_TYPE_SCROLL_WHITE 252 | TextTypeScrollRed // SIMCONNECT_TEXT_TYPE_SCROLL_RED 253 | TextTypeScrollGreen // SIMCONNECT_TEXT_TYPE_SCROLL_GREEN 254 | TextTypeScrollBlue // SIMCONNECT_TEXT_TYPE_SCROLL_BLUE 255 | TextTypeScrollYellow // SIMCONNECT_TEXT_TYPE_SCROLL_YELLOW 256 | TextTypeScrollMagenta // SIMCONNECT_TEXT_TYPE_SCROLL_MAGENTA 257 | TextTypeScrollCyan // SIMCONNECT_TEXT_TYPE_SCROLL_CYAN 258 | TextTypePrintBlack DWord = iota + 0x0100 // SIMCONNECT_TEXT_TYPE_PRINT_BLACK 259 | TextTypePrintWhite // SIMCONNECT_TEXT_TYPE_PRINT_WHITE 260 | TextTypePrintRed // SIMCONNECT_TEXT_TYPE_PRINT_RED 261 | TextTypePrintGreen // SIMCONNECT_TEXT_TYPE_PRINT_GREEN 262 | TextTypePrintBlue // SIMCONNECT_TEXT_TYPE_PRINT_BLUE 263 | TextTypePrintYellow // SIMCONNECT_TEXT_TYPE_PRINT_YELLOW 264 | TextTypePrintMagenta // SIMCONNECT_TEXT_TYPE_PRINT_MAGENTA 265 | TextTypePrintCyan // SIMCONNECT_TEXT_TYPE_PRINT_CYAN 266 | TextTypeMenu DWord = iota + 0x0200 // SIMCONNECT_TEXT_TYPE_MENU 267 | ) 268 | 269 | // SIMCONNECT_TEXT_RESULT 270 | // Used to specify which event has occurred as a result of a call to SimConnect_Text. 271 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_TEXT_RESULT.htm 272 | const ( 273 | TextResultMenuSelect1 DWord = iota // SIMCONNECT_TEXT_RESULT_MENU_SELECT_1 274 | TextResultMenuSelect2 // SIMCONNECT_TEXT_RESULT_MENU_SELECT_2 275 | TextResultMenuSelect3 // SIMCONNECT_TEXT_RESULT_MENU_SELECT_3 276 | TextResultMenuSelect4 // SIMCONNECT_TEXT_RESULT_MENU_SELECT_4 277 | TextResultMenuSelect5 // SIMCONNECT_TEXT_RESULT_MENU_SELECT_5 278 | TextResultMenuSelect6 // SIMCONNECT_TEXT_RESULT_MENU_SELECT_6 279 | TextResultMenuSelect7 // SIMCONNECT_TEXT_RESULT_MENU_SELECT_7 280 | TextResultMenuSelect8 // SIMCONNECT_TEXT_RESULT_MENU_SELECT_8 281 | TextResultMenuSelect9 // SIMCONNECT_TEXT_RESULT_MENU_SELECT_9 282 | TextResultMenuSelect10 // SIMCONNECT_TEXT_RESULT_MENU_SELECT_10 283 | TextResultDisplayed DWord = 0x00010000 // SIMCONNECT_TEXT_RESULT_DISPLAYED = 0x00010000 284 | TextResultQueued // SIMCONNECT_TEXT_RESULT_QUEUED 285 | TextResultRemoved // SIMCONNECT_TEXT_RESULT_REMOVED 286 | TextResultReplaced // SIMCONNECT_TEXT_RESULT_REPLACED 287 | TextResultTimeout // SIMCONNECT_TEXT_RESULT_TIMEOUT 288 | ) 289 | 290 | // // SIMCONNECT_WEATHER_MODE 291 | // const ( 292 | // WeatherModeTheme DWord = iota // SIMCONNECT_WEATHER_MODE_THEME 293 | // WeatherModeRWW // SIMCONNECT_WEATHER_MODE_RWW 294 | // WeatherModeCustom // SIMCONNECT_WEATHER_MODE_CUSTOM 295 | // WeatherModeGlobal // SIMCONNECT_WEATHER_MODE_GLOBAL 296 | // ) 297 | 298 | // SIMCONNECT_FACILITY_LIST_TYPE 299 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_FACILITY_LIST_TYPE.htm 300 | // Used to determine which type of facilities data is being requested or returned. 301 | const ( 302 | FacilityListTypeAirport DWord = iota // SIMCONNECT_FACILITY_LIST_TYPE_AIRPORT 303 | FacilityListTypeWaypoint // SIMCONNECT_FACILITY_LIST_TYPE_WAYPOINT 304 | FacilityListTypeNDB // SIMCONNECT_FACILITY_LIST_TYPE_NDB 305 | FacilityListTypeVOR // SIMCONNECT_FACILITY_LIST_TYPE_VOR 306 | FacilityListTypeCount // SIMCONNECT_FACILITY_LIST_TYPE_COUNT: invalid 307 | ) 308 | 309 | // SIMCONNECT_VOR_FLAGS: flags for SIMCONNECT_RECV_ID_VOR_LIST 310 | const ( 311 | RecvIDVORListHasNAVSignal DWord = 0x00000001 // SIMCONNECT_RECV_ID_VOR_LIST_HAS_NAV_SIGNAL: Has Nav signal 312 | RecvIDVORListHasLocalizer DWord = 0x00000002 // SIMCONNECT_RECV_ID_VOR_LIST_HAS_LOCALIZER: Has localizer 313 | RecvIDVORListHasGlideScope DWord = 0x00000004 // SIMCONNECT_RECV_ID_VOR_LIST_HAS_GLIDE_SLOPE: Has Nav signal 314 | RecvIDVORListHasDME DWord = 0x00000008 // SIMCONNECT_RECV_ID_VOR_LIST_HAS_DME: Station has DME 315 | ) 316 | 317 | // SIMCONNECT_WAYPOINT_FLAGS: bits for the Waypoint Flags field: may be combined 318 | const ( 319 | WaypointNone DWord = 0x00 // SIMCONNECT_WAYPOINT_NONE 320 | WaypointSpeedRequested DWord = 0x04 // SIMCONNECT_WAYPOINT_SPEED_REQUESTED: requested speed at waypoint is valid 321 | WaypointThrottleRequested DWord = 0x08 // SIMCONNECT_WAYPOINT_THROTTLE_REQUESTED: request a specific throttle percentage 322 | WaypointComputeVerticalSpeed DWord = 0x10 // SIMCONNECT_WAYPOINT_COMPUTE_VERTICAL_SPEED: compute vertical to speed to reach waypoint altitude when crossing the waypoint 323 | WaypointAltitudeIsAGL DWord = 0x20 // SIMCONNECT_WAYPOINT_ALTITUDE_IS_AGL: AltitudeIsAGL 324 | WaypointOnGround DWord = 0x00100000 // SIMCONNECT_WAYPOINT_ON_GROUND: place this waypoint on the ground 325 | WaypointReverse DWord = 0x00200000 // SIMCONNECT_WAYPOINT_REVERSE: Back up to this waypoint. Only valid on first waypoint 326 | WaypointWrapFirst DWord = 0x00400000 // SIMCONNECT_WAYPOINT_WRAP_TO_FIRST: Wrap around back to first waypoint. Only valid on last waypoint 327 | ) 328 | 329 | // SIMCONNECT_EVENT_FLAG 330 | const ( 331 | EventFlagDefault DWord = 0x00000000 // SIMCONNECT_EVENT_FLAG_DEFAULT 332 | EventFlagFastRepeatTimer DWord = 0x00000001 // SIMCONNECT_EVENT_FLAG_FAST_REPEAT_TIMER: set event repeat timer to simulate fast repeat 333 | EventFlagSlowRepeatTimer DWord = 0x00000002 // DWORD SIMCONNECT_EVENT_FLAG_SLOW_REPEAT_TIMER: set event repeat timer to simulate slow repeat 334 | EventFlagGroupIDIsPriority DWord = 0x00000010 // SIMCONNECT_EVENT_FLAG_GROUPID_IS_PRIORITY: interpret GroupID parameter as priority value 335 | ) 336 | 337 | // SIMCONNECT_DATA_REQUEST_FLAG 338 | const ( 339 | DataRequestFlagDefault DWord = 0x00000000 // SIMCONNECT_DATA_REQUEST_FLAG_DEFAULT 340 | DataRequestFlagChanged DWord = 0x00000001 // SIMCONNECT_DATA_REQUEST_FLAG_CHANGED: send requested data when value(s) change 341 | DataRequestFlagTagged DWord = 0x00000002 // SIMCONNECT_DATA_REQUEST_FLAG_TAGGED: send requested data in tagged format 342 | ) 343 | 344 | // SIMCONNECT_DATA_SET_FLAG 345 | const ( 346 | DataSetFlagDefault DWord = 0x00000000 // SIMCONNECT_DATA_SET_FLAG_DEFAULT 347 | DataSetFlagTagged DWord = 0x00000001 // SIMCONNECT_DATA_SET_FLAG_TAGGED: data is in tagged format 348 | ) 349 | 350 | // SIMCONNECT_CREATE_CLIENT_DATA_FLAG 351 | const ( 352 | CreateClientDataFlagDefault DWord = 0x00000000 // SIMCONNECT_CREATE_CLIENT_DATA_FLAG_DEFAULT 353 | CreateClientDataFlagReadOnly DWord = 0x00000001 // SIMCONNECT_CREATE_CLIENT_DATA_FLAG_READ_ONLY: permit only ClientData creator to write into ClientData 354 | ) 355 | 356 | // SIMCONNECT_CLIENT_DATA_REQUEST_FLAG 357 | const ( 358 | ClientDataRequestFlagDefault DWord = 0x00000000 // SIMCONNECT_CLIENT_DATA_REQUEST_FLAG_DEFAULT 359 | ClientDataRequestFlagChanged DWord = 0x00000001 // SIMCONNECT_CLIENT_DATA_REQUEST_FLAG_CHANGED: send requested ClientData when value(s) change 360 | ClientDataRequestFlagTagged DWord = 0x00000002 // SIMCONNECT_CLIENT_DATA_REQUEST_FLAG_TAGGED: send requested ClientData in tagged format 361 | ) 362 | 363 | // SIMCONNECT_CLIENT_DATA_SET_FLAG 364 | const ( 365 | ClientDataSetFlagDefault DWord = 0x00000000 // SIMCONNECT_CLIENT_DATA_SET_FLAG_DEFAULT 366 | ClientDataSetFlagTagged DWord = 0x00000001 // SIMCONNECT_CLIENT_DATA_SET_FLAG_TAGGED: data is in tagged format 367 | ) 368 | 369 | // SIMCONNECT_VIEW_SYSTEM_EVENT_DATA: dwData contains these flags for the "View" System Event 370 | const ( 371 | ViewSystemEventDataCockpit2D DWord = 0x00000001 // SIMCONNECT_VIEW_SYSTEM_EVENT_DATA_COCKPIT_2D: 2D Panels in cockpit view 372 | ViewSystemEventDataCockpitVirtual DWord = 0x00000002 // SIMCONNECT_VIEW_SYSTEM_EVENT_DATA_COCKPIT_VIRTUAL: Virtual (3D) panels in cockpit view 373 | ViewSystemEventDataOrthogonal DWord = 0x00000004 // SIMCONNECT_VIEW_SYSTEM_EVENT_DATA_ORTHOGONAL: Orthogonal (Map) view 374 | ) 375 | 376 | // SIMCONNECT_SOUND_SYSTEM_EVENT_DATA: dwData contains these flags for the "Sound" System Event 377 | const ( 378 | SoundSystemEventDataMaster DWord = 0x00000001 // SIMCONNECT_SOUND_SYSTEM_EVENT_DATA_MASTER: Sound Master 379 | ) 380 | 381 | // SIMCONNECT_USER_ENUM SIMCONNECT_NOTIFICATION_GROUP_ID; //client-defined notification group ID 382 | // SIMCONNECT_USER_ENUM SIMCONNECT_INPUT_GROUP_ID; //client-defined input group ID 383 | // SIMCONNECT_USER_ENUM SIMCONNECT_DATA_DEFINITION_ID; //client-defined data definition ID 384 | // SIMCONNECT_USER_ENUM SIMCONNECT_DATA_REQUEST_ID; //client-defined request data ID 385 | 386 | // SIMCONNECT_USER_ENUM SIMCONNECT_CLIENT_EVENT_ID; //client-defined client event ID 387 | // SIMCONNECT_USER_ENUM SIMCONNECT_CLIENT_DATA_ID; //client-defined client data ID 388 | // SIMCONNECT_USER_ENUM SIMCONNECT_CLIENT_DATA_DEFINITION_ID; //client-defined client data definition ID 389 | 390 | // SIMCONNECT_RECV 391 | // Used with the SIMCONNECT_RECV_ID enumeration to indicate which type of structure has been returned. 392 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_RECV.htm 393 | type Recv struct { 394 | Size DWord // record size 395 | Version DWord // interface version 396 | ID DWord // see SIMCONNECT_RECV_ID 397 | } 398 | 399 | // SIMCONNECT_RECV_EXCEPTION: when dwID == SIMCONNECT_RECV_ID_EXCEPTION 400 | // Used with the SIMCONNECT_EXCEPTION enumeration type to return information on an error that has occurred. 401 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_RECV_EXCEPTION.htm 402 | type RecvException struct { 403 | Recv 404 | Exception DWord // SIMCONNECT_EXCEPTION 405 | SendID DWord // SimConnect_GetLastSentPacketID 406 | Index DWord // index of parameter that was source of error 407 | } 408 | 409 | // SIMCONNECT_RECV_OPEN: when dwID == SIMCONNECT_RECV_ID_OPEN 410 | // Used to return information to the client, after a successful call to SimConnect_Open. 411 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_RECV_OPEN.htm 412 | type RecvOpen struct { 413 | Recv 414 | ApplicationName [256]byte 415 | ApplicationVersionMajor DWord 416 | ApplicationVersionMinor DWord 417 | ApplicationBuildMajor DWord 418 | ApplicationBuildMinor DWord 419 | SimConnectVersionMajor DWord 420 | SimConnectVersionMinor DWord 421 | SimConnectBuildMajor DWord 422 | SimConnectBuildMinor DWord 423 | Reserved1 DWord 424 | Reserved2 DWord 425 | } 426 | 427 | // SIMCONNECT_RECV_QUIT: when dwID == SIMCONNECT_RECV_ID_QUIT 428 | // This is an identical structure to the SIMCONNECT_RECV structure. 429 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_RECV_QUIT.htm 430 | type RecvQuit struct { 431 | Recv 432 | } 433 | 434 | // SIMCONNECT_RECV_EVENT: when dwID == SIMCONNECT_RECV_ID_EVENT 435 | // Used to return an event ID to the client. 436 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_RECV_EVENT.htm 437 | type RecvEvent struct { 438 | Recv 439 | GroupID DWord 440 | EventID DWord 441 | Data DWord // uEventID-dependent context 442 | } 443 | 444 | // SIMCONNECT_RECV_EVENT_FILENAME: when dwID == SIMCONNECT_RECV_ID_EVENT_FILENAME 445 | // Used with the SimConnect_SubscribeToSystemEvent to return a filename and an event ID to the client. 446 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_RECV_EVENT_FILENAME.htm 447 | type RecvEventFilename struct { 448 | RecvEvent 449 | FileName [260]byte // uEventID-dependent context 450 | Flags DWord 451 | } 452 | 453 | // SIMCONNECT_RECV_EVENT_OBJECT_ADDREMOVE: when dwID == SIMCONNECT_RECV_ID_EVENT_OBJECT_ADDREMOVE 454 | type RecvEventObjectAddRemove struct { 455 | RecvEvent 456 | ObjType DWord // SIMCONNECT_SIMOBJECT_TYPE 457 | } 458 | 459 | // SIMCONNECT_RECV_EVENT_FRAME: when dwID == SIMCONNECT_RECV_ID_EVENT_FRAME 460 | // Used with the SimConnect_SubscribeToSystemEvent to return the frame rate and simulation speed to the client. 461 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_RECV_EVENT_FRAME.htm 462 | type RecvEventFrame struct { 463 | RecvEvent 464 | FrameRate float32 465 | SimSpeed float32 466 | } 467 | 468 | // SIMCONNECT_RECV_EVENT_MULTIPLAYER_SERVER_STARTED: when dwID == SIMCONNECT_RECV_ID_EVENT_MULTIPLAYER_SERVER_STARTED 469 | // type RecvEventMultiplayerServerStarted struct { 470 | // RecvEvent 471 | // // No event specific data, for now 472 | // } 473 | 474 | // SIMCONNECT_RECV_EVENT_MULTIPLAYER_CLIENT_STARTED: when dwID == SIMCONNECT_RECV_ID_EVENT_MULTIPLAYER_CLIENT_STARTED 475 | // type RecvEventMultiplayerClientStarted struct { 476 | // RecvEvent 477 | // // No event specific data, for now 478 | // } 479 | 480 | // SIMCONNECT_RECV_EVENT_MULTIPLAYER_SESSION_ENDED: when dwID == SIMCONNECT_RECV_ID_EVENT_MULTIPLAYER_SESSION_ENDED 481 | // type RecvEventMultiplayerSessionEnded struct { 482 | // RecvEvent 483 | // // No event specific data, for now 484 | // } 485 | 486 | // GUID structure from guiddef.h 487 | // typedef struct _GUID { 488 | // unsigned long Data1; 489 | // unsigned short Data2; 490 | // unsigned short Data3; 491 | // unsigned char Data4[8]; 492 | // } GUID; 493 | 494 | // SIMCONNECT_DATA_RACE_RESULT 495 | // type DataRaceResult struct { 496 | // NumberOfRacers DWord // The total number of racers 497 | // MissionGUID windows.GUID // The name of the mission to execute, NULL if no mission 498 | // PlayerName [260]byte // The name of the player 499 | // SessionType [260]byte // The type of the multiplayer session: "LAN", "GAMESPY") 500 | // Aircraft [260]byte // The aircraft type 501 | // PlayerRole [260]byte // The player role in the mission 502 | // TotalTime float64 // Total time in seconds, 0 means DNF 503 | // PenaltyTime float64 // Total penalty time in seconds 504 | // IsDisqualified DWord // non 0 - disqualified, 0 - not disqualified 505 | // } 506 | 507 | // SIMCONNECT_RECV_EVENT_RACE_END: when dwID == SIMCONNECT_RECV_ID_EVENT_RACE_END 508 | // type RecvEventRaceEnd struct { 509 | // RecvEvent 510 | // RacerNumber DWord // The index of the racer the results are for 511 | // RacerData DataRaceResult 512 | // } 513 | 514 | // SIMCONNECT_RECV_EVENT_RACE_LAP: when dwID == SIMCONNECT_RECV_ID_EVENT_RACE_LAP 515 | // type RecvEventRaceLap struct { 516 | // LapIndex DWord // The index of the lap the results are for 517 | // RacerData DataRaceResult 518 | // } 519 | 520 | // SIMCONNECT_RECV_SIMOBJECT_DATA: when dwID == SIMCONNECT_RECV_ID_SIMOBJECT_DATA 521 | // Will be received by the client after a successful call to SimConnect_RequestDataOnSimObject or SimConnect_RequestDataOnSimObjectType. 522 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_RECV_SIMOBJECT_DATA.htm 523 | type RecvSimObjectData struct { 524 | Recv 525 | RequestID DWord 526 | ObjectID DWord 527 | DefineID DWord 528 | Flags DWord // SIMCONNECT_DATA_REQUEST_FLAG 529 | EntryNumber DWord // if multiple objects returned, this is number out of 530 | OutOf DWord // note: starts with 1, not 0 531 | DefineCount DWord // data count (number of datums, *not* byte count) 532 | // SIMCONNECT_DATAV(dwData, dwDefineID); // data begins here, dwDefineCount data items 533 | } 534 | 535 | // SIMCONNECT_RECV_SIMOBJECT_DATA_BYTYPE: when dwID == SIMCONNECT_RECV_ID_SIMOBJECT_DATA_BYTYPE 536 | // Will be received by the client after a successful call to SimConnect_RequestDataOnSimObjectType. The structure is identical to SIMCONNECT_RECV_SIMOBJECT_DATA. 537 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_RECV_SIMOBJECT_DATA_BYTYPE.htm 538 | type RecvSimObjectDataByType struct { 539 | RecvSimObjectData 540 | } 541 | 542 | // SIMCONNECT_RECV_CLIENT_DATA: when dwID == SIMCONNECT_RECV_ID_CLIENT_DATA 543 | // Will be received by the client after a successful call to SimConnect_RequestClientData. The structure is identical to SIMCONNECT_RECV_SIMOBJECT_DATA. 544 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_RECV_CLIENT_DATA.htm 545 | type RecvClientData struct { 546 | RecvSimObjectData 547 | } 548 | 549 | // SIMCONNECT_RECV_WEATHER_OBSERVATION: when dwID == SIMCONNECT_RECV_ID_WEATHER_OBSERVATION 550 | // type RecvWeatherObservation struct { 551 | // Recv 552 | // requestID DWord 553 | // metar [1]byte // SIMCONNECT_STRINGV(szMetar): Variable length string whose maximum size is MAX_METAR_LENGTH 554 | // } 555 | 556 | // const ( 557 | // CloudStateArrayWidth int = 64 // SIMCONNECT_CLOUD_STATE_ARRAY_WIDTH 558 | // CloudStateArraySize int = CloudStateArrayWidth * CloudStateArrayWidth // SIMCONNECT_CLOUD_STATE_ARRAY_SIZE 559 | // ) 560 | 561 | // SIMCONNECT_RECV_CLOUD_STATE: when dwID == SIMCONNECT_RECV_ID_CLOUD_STATE 562 | // type RecvCloudState struct { 563 | // Recv 564 | // RequestID DWord 565 | // ArraySize DWord 566 | // // SIMCONNECT_FIXEDTYPE_DATAV(BYTE, rgbData, dwArraySize, U1 /*member of UnmanagedType enum*/ , System::Byte /*cli type*/); 567 | // } 568 | 569 | // SIMCONNECT_RECV_ASSIGNED_OBJECT_ID: when dwID == SIMCONNECT_RECV_ID_ASSIGNED_OBJECT_ID 570 | // Used to return an object ID that matches a request ID. 571 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_RECV_ASSIGNED_OBJECT_ID.htm 572 | type RecvAssignedObjectID struct { 573 | Recv 574 | RequestID DWord 575 | ObjectID DWord 576 | } 577 | 578 | // SIMCONNECT_RECV_RESERVED_KEY: when dwID == SIMCONNECT_RECV_ID_RESERVED_KEY 579 | // Used with the SimConnect_RequestReservedKey function to return the reserved key combination. 580 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_RECV_RESERVED_KEY.htm 581 | type RecvReservedKey struct { 582 | Recv 583 | ChoiceReserved [30]byte 584 | ReservedKey [50]byte 585 | } 586 | 587 | // SIMCONNECT_RECV_SYSTEM_STATE : public SIMCONNECT_RECV // when dwID == SIMCONNECT_RECV_ID_SYSTEM_STATE 588 | // Used with the SimConnect_RequestSystemState function to retrieve specific Flight Simulator systems states and information. 589 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_RECV_SYSTEM_STATE.htm 590 | type RecvSystemState struct { 591 | Recv 592 | RequestID DWord 593 | Integer DWord 594 | Float float32 595 | String [260]byte 596 | } 597 | 598 | // SIMCONNECT_RECV_CUSTOM_ACTION : public SIMCONNECT_RECV_EVENT 599 | // type RecvCustomAction struct { 600 | // RecvEvent 601 | // InstanceID windows.GUID // Instance id of the action that executed 602 | // WaitForCompletion DWord // Wait for completion flag on the action 603 | // Payload [1]byte // SIMCONNECT_STRINGV(szPayLoad): Variable length string payload associated with the mission action 604 | // } 605 | 606 | // SIMCONNECT_RECV_EVENT_WEATHER_MODE : public SIMCONNECT_RECV_EVENT 607 | // type RecvEventWeatherMode struct { 608 | // // No event specific data - the new weather mode is in the base structure dwData member 609 | // } 610 | 611 | // SIMCONNECT_RECV_FACILITIES_LIST 612 | // Used to provide information on the number of elements in a list of facilities returned to the client, and the number of packets that were used to transmit the data. 613 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_RECV_FACILITIES_LIST.htm 614 | type RecvFacilitiesList struct { 615 | Recv 616 | RequestID DWord 617 | ArraySize DWord 618 | EntryNumber DWord // when the array of items is too big for one send, which send this is (0..dwOutOf-1) 619 | OutOf DWord // total number of transmissions the list is chopped into 620 | } 621 | 622 | // SIMCONNECT_DATA_FACILITY_AIRPORT 623 | // Used to return information on a single airport in the facilities cache. 624 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_DATA_FACILITY_AIRPORT.htm 625 | type DataFacilityAirport struct { 626 | Icao [9]byte // ICAO of the object 627 | Latitude float64 // degrees 628 | Longitude float64 // degrees 629 | Altitude float64 // meters 630 | } 631 | 632 | // SIMCONNECT_RECV_AIRPORT_LIST 633 | // Used to return a list of SIMCONNECT_DATA_FACILITY_AIRPORT structures. 634 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_RECV_AIRPORT_LIST.htm 635 | type RecvAirportList struct { 636 | RecvFacilitiesList 637 | // SIMCONNECT_FIXEDTYPE_DATAV(SIMCONNECT_DATA_FACILITY_AIRPORT, rgData, dwArraySize, U1 /*member of UnmanagedType enum*/, SIMCONNECT_DATA_FACILITY_AIRPORT /*cli type*/) 638 | } 639 | 640 | // SIMCONNECT_DATA_FACILITY_WAYPOINT 641 | // Used to return information on a single waypoint in the facilities cache. 642 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_DATA_FACILITY_WAYPOINT.htm 643 | type DataFacilityWaypoint struct { 644 | DataFacilityAirport 645 | MagVar float32 // Magvar in degrees 646 | } 647 | 648 | // SIMCONNECT_RECV_WAYPOINT_LIST 649 | // Used to return a list of SIMCONNECT_DATA_FACILITY_WAYPOINT structures. 650 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_RECV_WAYPOINT_LIST.htm 651 | type RecvWaypointList struct { 652 | RecvFacilitiesList 653 | // SIMCONNECT_FIXEDTYPE_DATAV(SIMCONNECT_DATA_FACILITY_WAYPOINT, rgData, dwArraySize, U1 /*member of UnmanagedType enum*/, SIMCONNECT_DATA_FACILITY_WAYPOINT /*cli type*/) 654 | } 655 | 656 | // SIMCONNECT_DATA_FACILITY_NDB 657 | // Used to return information on a single NDB station in the facilities cache. 658 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_DATA_FACILITY_NDB.htm 659 | type DataFacilityNDB struct { 660 | DataFacilityWaypoint 661 | Frequency DWord // frequency in Hz 662 | } 663 | 664 | // SIMCONNECT_RECV_NDB_LIST 665 | // Used to return a list of SIMCONNECT_DATA_FACILITY_NDB structures. 666 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_RECV_NDB_LIST.htm 667 | type RecvNDBList struct { 668 | RecvFacilitiesList 669 | // SIMCONNECT_FIXEDTYPE_DATAV(SIMCONNECT_DATA_FACILITY_NDB, rgData, dwArraySize, U1 /*member of UnmanagedType enum*/, SIMCONNECT_DATA_FACILITY_NDB /*cli type*/) 670 | } 671 | 672 | // SIMCONNECT_DATA_FACILITY_VOR 673 | // Used to return information on a single VOR station in the facilities cache. 674 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_DATA_FACILITY_VOR.htm 675 | type DataFacilityVOR struct { 676 | DataFacilityNDB 677 | Flags DWord // SIMCONNECT_VOR_FLAGS 678 | Localizer float32 // Localizer in degrees 679 | GlideLat float64 // Glide Slope Location (deg, deg, meters) 680 | GlideLon float64 681 | GlideAlt float64 682 | GlideSlopeAngle float32 // Glide Slope in degrees 683 | } 684 | 685 | // SIMCONNECT_RECV_VOR_LIST 686 | // Used to return a list of SIMCONNECT_DATA_FACILITY_VOR structures. 687 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_RECV_VOR_LIST.htm 688 | type RecvVORList struct { 689 | RecvFacilitiesList 690 | // SIMCONNECT_FIXEDTYPE_DATAV(SIMCONNECT_DATA_FACILITY_VOR, rgData, dwArraySize, U1 /*member of UnmanagedType enum*/, SIMCONNECT_DATA_FACILITY_VOR /*cli type*/) 691 | } 692 | 693 | // SIMCONNECT_DATATYPE_INITPOSITION 694 | type InitPosition struct { 695 | Latitude float64 // degrees 696 | Longitude float64 // degrees 697 | Altitude float64 // feet 698 | Pitch float64 // degrees 699 | Bank float64 // degrees 700 | Heading float64 // degrees 701 | OnGround DWord // 1=force to be on the ground 702 | Airspeed DWord // knots 703 | } 704 | 705 | // SIMCONNECT_DATATYPE_MARKERSTATE 706 | // type MarkerState struct { 707 | // MarkerName [64]byte 708 | // MarkerState DWord 709 | // } 710 | 711 | // SIMCONNECT_DATATYPE_WAYPOINT 712 | // type Waypoint struct { 713 | // Latitude float64 // degrees 714 | // Longitude float64 // degrees 715 | // Altitude float64 // feet 716 | // Flags uint32 717 | // ktsSpeed float64 // knots 718 | // percentThrottle float64 719 | // } 720 | 721 | // SIMCONNECT_DATA_LATLONALT 722 | // Used to hold a world position. 723 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_DATA_LATLONALT.htm 724 | type LatLogAlt struct { 725 | Latitude float64 726 | Longitude float64 727 | Altitude float64 728 | } 729 | 730 | // SIMCONNECT_DATA_XYZ 731 | // Used to hold a 3D co-ordinate. 732 | // https://docs.flightsimulator.com/html/Programming_Tools/SimConnect/API_Reference/Structures_And_Enumerations/SIMCONNECT_DATA_XYZ.htm 733 | type XYZ struct { 734 | X float64 735 | Y float64 736 | Z float64 737 | } 738 | -------------------------------------------------------------------------------- /simconnect/simconnect.go: -------------------------------------------------------------------------------- 1 | package simconnect 2 | 3 | import ( 4 | "fmt" 5 | "os" 6 | "path/filepath" 7 | "sync" 8 | "syscall" 9 | "unsafe" 10 | 11 | log "github.com/sirupsen/logrus" 12 | ) 13 | 14 | const ( 15 | SimConnectDLL = "SimConnect.dll" 16 | ) 17 | 18 | var ( 19 | library *syscall.LazyDLL 20 | procs map[string]*syscall.LazyProc 21 | lockID sync.Mutex 22 | defineID DWord 23 | eventID DWord 24 | requestID DWord 25 | initialized bool 26 | ) 27 | 28 | func init() { 29 | log.SetFormatter(&log.TextFormatter{ 30 | FullTimestamp: true, 31 | }) 32 | } 33 | 34 | type SimConnect struct { 35 | handle unsafe.Pointer 36 | connected bool 37 | } 38 | 39 | func NewSimConnect() *SimConnect { 40 | if !initialized { 41 | panic("SimConnect not initialized.") 42 | } 43 | return &SimConnect{} 44 | } 45 | 46 | func LocateLibrary(additionalSearchPath string) (string, error) { 47 | var libPath string 48 | paths, err := getSearchPaths(additionalSearchPath) 49 | if err != nil { 50 | return libPath, err 51 | } 52 | 53 | libPath, err = findLibrary(paths) 54 | if err != nil { 55 | return libPath, err 56 | } 57 | return libPath, nil 58 | } 59 | 60 | func Initialize(additionalSearchPath string) error { 61 | if initialized { 62 | return nil 63 | } 64 | 65 | paths, err := getSearchPaths(additionalSearchPath) 66 | if err != nil { 67 | return err 68 | } 69 | 70 | libPath, err := findLibrary(paths) 71 | if err != nil { 72 | return err 73 | } 74 | 75 | if err := loadLibrary(libPath); err != nil { 76 | return err 77 | } 78 | 79 | loadProcs() 80 | initialized = true 81 | return nil 82 | } 83 | 84 | func IsInitialized() bool { 85 | return initialized 86 | } 87 | 88 | func (simco *SimConnect) IsConnected() bool { 89 | return simco.connected 90 | } 91 | 92 | func NewDefineID() DWord { 93 | lockID.Lock() 94 | defer lockID.Unlock() 95 | defineID++ 96 | return defineID 97 | } 98 | 99 | func NewRequestID() DWord { 100 | lockID.Lock() 101 | defer lockID.Unlock() 102 | requestID++ 103 | return requestID 104 | } 105 | 106 | func NewEventID() DWord { 107 | lockID.Lock() 108 | defer lockID.Unlock() 109 | eventID++ 110 | return eventID 111 | } 112 | 113 | func getSearchPaths(additionalSearchPath string) ([]string, error) { 114 | paths := []string{} 115 | if len(additionalSearchPath) > 0 { 116 | paths = append(paths, additionalSearchPath) 117 | } 118 | 119 | execPath, err := os.Executable() 120 | if err != nil { 121 | return paths, err 122 | } 123 | 124 | cwd, err := os.Getwd() 125 | if err != nil { 126 | return paths, err 127 | } 128 | paths = append(paths, filepath.Dir(execPath), cwd) 129 | return append(paths, cwd), nil 130 | } 131 | 132 | func findLibrary(searchPaths []string) (string, error) { 133 | for _, path := range searchPaths { 134 | libPath := filepath.Join(path, SimConnectDLL) 135 | if _, err := os.Stat(libPath); os.IsNotExist(err) { 136 | continue 137 | } 138 | return libPath, nil 139 | } 140 | return "", fmt.Errorf("could not locate %s in search paths", SimConnectDLL) 141 | } 142 | 143 | func loadLibrary(path string) error { 144 | library = syscall.NewLazyDLL(path) 145 | if err := library.Load(); err != nil { 146 | return err 147 | } 148 | return nil 149 | } 150 | 151 | func loadProcs() { 152 | procs = make(map[string]*syscall.LazyProc) 153 | procNames := []string{ 154 | scOpen, 155 | scClose, 156 | // scCallDispatch, 157 | scGetNextDispatch, 158 | scRequestSystemState, 159 | scMapClientEventToSimEvent, 160 | scSubscribeToSystemEvent, 161 | scSetSystemEventState, 162 | scUnsubscribeFromSystemEvent, 163 | scSetNotificationGroupPriority, 164 | scText, 165 | scRequestDataOnSimObject, 166 | scRequestDataOnSimObjectType, 167 | scAddClientEventToNotificationGroup, 168 | scRemoveClientEvent, 169 | scTransmitClientEvent, 170 | scMapClientDataNameToID, 171 | scRequestClientData, 172 | scCreateClientData, 173 | scAddToClientDataDefinition, 174 | scAddToDataDefinition, 175 | scSetClientData, 176 | scSetDataOnSimObject, 177 | scClearClientDataDefinition, 178 | scClearDataDefinition, 179 | scMapInputEventToClientEvent, 180 | scRequestNotificationGroup, 181 | scClearInputGroup, 182 | scClearNotificationGroup, 183 | // scRequestReservedKey, 184 | scSetInputGroupPriority, 185 | scSetInputGroupState, 186 | scRemoveInputEvent, 187 | scAICreateEnrouteATCAircraft, 188 | scAICreateNonATCAircraft, 189 | scAICreateParkedATCAircraft, 190 | scAICreateSimulatedObject, 191 | scAIReleaseControl, 192 | scAIRemoveObject, 193 | scAISetAircraftFlightPlan, 194 | scFlightLoad, 195 | scFlightSave, 196 | scFlightPlanLoad, 197 | scGetLastSentPacketID, 198 | // scRequestResponseTimes, 199 | // scInsertString, 200 | // scRetrieveString, 201 | scRequestFacilitiesList, 202 | scSubscribeToFacilities, 203 | scUnsubscribeToFacilities, 204 | // scCompleteCustomMissionAction, 205 | // scExecuteMissionAction, 206 | scMenuAddItem, 207 | scMenuAddSubItem, 208 | scMenuDeleteItem, 209 | scMenuDeleteSubItem, 210 | scCameraSetRelative6DOF, 211 | scSetSystemState, 212 | } 213 | for _, procName := range procNames { 214 | procs[procName] = library.NewProc(procName) 215 | } 216 | } 217 | 218 | func callProc(procName string, args ...uintptr) error { 219 | proc, ok := procs[procName] 220 | if !ok { 221 | return fmt.Errorf("proc %s not defined", procName) 222 | } 223 | r1, _, err := proc.Call(args...) 224 | if int32(r1) < 0 { 225 | return fmt.Errorf("%s error: %d %s", procName, r1, err) 226 | } 227 | return nil 228 | } 229 | 230 | func toNullTerminatedBytes(str string) []byte { 231 | return []byte(str + "\x00") 232 | } 233 | 234 | func toCharPtr(str string) uintptr { 235 | bytes := toNullTerminatedBytes(str) 236 | return uintptr(unsafe.Pointer(&bytes[0])) 237 | } 238 | 239 | func toBoolPtr(value bool) uintptr { 240 | v := 0 241 | if value { 242 | v = 1 243 | } 244 | return uintptr(v) 245 | } 246 | -------------------------------------------------------------------------------- /simconnect/simmate.go: -------------------------------------------------------------------------------- 1 | package simconnect 2 | 3 | import ( 4 | "fmt" 5 | "strings" 6 | "sync" 7 | "time" 8 | "unsafe" 9 | 10 | log "github.com/sirupsen/logrus" 11 | ) 12 | 13 | const ( 14 | simVarRequestTimeout int64 = 10000 15 | ) 16 | 17 | type OnOpenFunc func(applName, applVersion, applBuild, simConnectVersion, simConnectBuild string) 18 | type OnQuitFunc func() 19 | type OnSimObjectDataFunc func(data *RecvSimObjectData) 20 | type OnSimObjectDataByTypeFunc func(data *RecvSimObjectDataByType) 21 | type OnDataReadyFunc func() 22 | type OnEventIDFunc func(eventID DWord) 23 | type OnExceptionFunc func(exceptionCode DWord) 24 | 25 | type EventListener struct { 26 | OnOpen OnOpenFunc 27 | OnQuit OnQuitFunc 28 | OnSimObjectData OnSimObjectDataFunc 29 | OnSimObjectDataByType OnSimObjectDataByTypeFunc 30 | OnDataReady OnDataReadyFunc 31 | OnEventID OnEventIDFunc 32 | OnException OnExceptionFunc 33 | } 34 | 35 | type SimMate struct { 36 | SimConnect 37 | simVarManager *SimVarManager 38 | mutex sync.Mutex 39 | dirty bool 40 | } 41 | 42 | func NewSimMate() *SimMate { 43 | if !initialized { 44 | Initialize("") 45 | } 46 | mate := &SimMate{ 47 | simVarManager: NewSimVarManager(), 48 | } 49 | return mate 50 | } 51 | 52 | func (mate *SimMate) AddSimVar(name, unit string, dataType DWord) DWord { 53 | defineID := mate.simVarManager.Add(name, unit, dataType) 54 | mate.dirty = true 55 | return defineID 56 | } 57 | 58 | func (mate *SimMate) RemoveSimVar(defineID DWord) bool { 59 | if ok := mate.simVarManager.Remove(defineID); !ok { 60 | return false 61 | } 62 | return true 63 | } 64 | 65 | func (mate *SimMate) SimVarValueAndDataType(defineID DWord) (interface{}, DWord, bool) { 66 | mate.mutex.Lock() 67 | defer mate.mutex.Unlock() 68 | simVar, ok := mate.simVarManager.GetSimVar(defineID) 69 | if !ok { 70 | return nil, DataTypeInvalid, false 71 | } 72 | return simVar.Value, simVar.DataType, true 73 | } 74 | 75 | func (mate *SimMate) SimVar(defineID DWord) (SimVar, bool) { 76 | mate.mutex.Lock() 77 | defer mate.mutex.Unlock() 78 | simVar, ok := mate.simVarManager.GetSimVar(defineID) 79 | if !ok { 80 | return SimVar{}, false 81 | } 82 | return *simVar, true 83 | } 84 | 85 | func (mate *SimMate) SimVarDump(indent string) []string { 86 | mate.mutex.Lock() 87 | defer mate.mutex.Unlock() 88 | return mate.simVarManager.SimVarDump(indent) 89 | } 90 | 91 | func (mate *SimMate) SetSimObjectData(name, unit string, value interface{}, dataType DWord) error { 92 | defineID := NewDefineID() 93 | if err := mate.AddToDataDefinition(defineID, name, unit, DataTypeFloat64); err != nil { 94 | return err 95 | } 96 | switch dataType { 97 | case DataTypeFloat64: 98 | buffer := [1]float64{ 99 | ValueToFloat64(value), 100 | } 101 | size := DWord(unsafe.Sizeof(buffer)) 102 | mate.SetDataOnSimObject(defineID, ObjectIDUser, 0, 0, size, unsafe.Pointer(&buffer[0])) 103 | 104 | default: 105 | log.Tracef("SimConnect.SetSimObjectData: datatype not implemented: %v", dataType) 106 | } 107 | return nil 108 | } 109 | 110 | func (mate *SimMate) HandleEvents(requestDataInterval time.Duration, receiveDataInterval time.Duration, stop chan interface{}, listener *EventListener) { 111 | reqDataTicker := time.NewTicker(requestDataInterval) 112 | defer reqDataTicker.Stop() 113 | 114 | recvDataTicker := time.NewTicker(receiveDataInterval) 115 | defer recvDataTicker.Stop() 116 | 117 | requestCount := 0 118 | updateCount := 0 119 | 120 | for { 121 | select { 122 | case <-stop: 123 | return 124 | 125 | case <-reqDataTicker.C: 126 | if updateCount > 0 { 127 | if listener != nil && listener.OnDataReady != nil { 128 | listener.OnDataReady() 129 | } 130 | } 131 | mate.requestSimObjectData() 132 | requestCount++ 133 | 134 | case <-recvDataTicker.C: 135 | ppData, r1, err := mate.GetNextDispatch() 136 | if r1 < 0 { 137 | if uint32(r1) != EFail { 138 | log.Tracef("GetNextDispatch error: %s (%d)", err.Error(), r1) 139 | return 140 | } 141 | if ppData == nil { 142 | break 143 | } 144 | } 145 | 146 | recv := *(*Recv)(ppData) 147 | switch recv.ID { 148 | case RecvIDException: 149 | recvException := *(*RecvException)(ppData) 150 | if listener != nil && listener.OnException != nil { 151 | listener.OnException(recvException.Exception) 152 | } 153 | 154 | case RecvIDOpen: 155 | recvOpen := *(*RecvOpen)(ppData) 156 | applName := strings.Trim(string(recvOpen.ApplicationName[:256]), "\x00") 157 | applVersion := fmt.Sprintf("%d.%d", recvOpen.ApplicationVersionMajor, recvOpen.ApplicationVersionMinor) 158 | applBuild := fmt.Sprintf("%d.%d", recvOpen.ApplicationBuildMajor, recvOpen.ApplicationBuildMinor) 159 | simConnectVersion := fmt.Sprintf("%d.%d", recvOpen.SimConnectVersionMajor, recvOpen.SimConnectVersionMinor) 160 | simConnectBuild := fmt.Sprintf("%d.%d", recvOpen.SimConnectBuildMajor, recvOpen.SimConnectBuildMinor) 161 | if listener != nil && listener.OnOpen != nil { 162 | listener.OnOpen(applName, applVersion, applBuild, simConnectVersion, simConnectBuild) 163 | } 164 | 165 | case RecvIDQuit: 166 | if listener != nil && listener.OnQuit != nil { 167 | listener.OnQuit() 168 | } 169 | 170 | case RecvIDEvent: 171 | recvEvent := *(*RecvEvent)(ppData) 172 | if listener != nil && listener.OnEventID != nil { 173 | listener.OnEventID(recvEvent.EventID) 174 | } 175 | 176 | // case RecvIDEventObjectAddRemove: 177 | // case RecvIDEventFilename: 178 | // case RecvIDEventFrame: 179 | 180 | case RecvIDSimobjectData: 181 | recvData := *(*RecvSimObjectData)(ppData) 182 | if listener != nil && listener.OnSimObjectData != nil { 183 | listener.OnSimObjectData(&recvData) 184 | } 185 | 186 | case RecvIDSimObjectDataByType: 187 | recvData := *(*RecvSimObjectDataByType)(ppData) 188 | simVar, exists := mate.simVarManager.GetSimVar(recvData.DefineID) 189 | if !exists { 190 | continue 191 | } 192 | 193 | var value interface{} 194 | switch simVar.DataType { 195 | case DataTypeInt32: 196 | value = (*SimObjectData_int32)(ppData).Value 197 | 198 | case DataTypeInt64: 199 | value = (*SimObjectData_int64)(ppData).Value 200 | 201 | case DataTypeFloat32: 202 | value = (*SimObjectData_float32)(ppData).Value 203 | 204 | case DataTypeFloat64: 205 | value = (*SimObjectData_float64)(ppData).Value 206 | 207 | case DataTypeString8: 208 | value = (*SimObjectData_string8)(ppData).Value 209 | 210 | case DataTypeString32: 211 | value = (*SimObjectData_string32)(ppData).Value 212 | 213 | case DataTypeString64: 214 | value = (*SimObjectData_string64)(ppData).Value 215 | 216 | case DataTypeString128: 217 | value = (*SimObjectData_string128)(ppData).Value 218 | 219 | case DataTypeString256: 220 | value = (*SimObjectData_string256)(ppData).Value 221 | 222 | case DataTypeString260: 223 | value = (*SimObjectData_string260)(ppData).Value 224 | 225 | case DataTypeStringV: 226 | value = (*SimObjectData_stringv)(ppData).Value 227 | 228 | // case DataTypeInitPosition: 229 | // case DataTypeStringMarkerState: 230 | // case DataTypeWaypoint: 231 | // case DataTypeStringLatLonAlt: 232 | // case DataTypeStringXYZ: 233 | default: 234 | } 235 | if value != nil { 236 | mate.updateSimObjectData(recvData.RequestID, recvData.DefineID, value) 237 | updateCount++ 238 | } 239 | if listener != nil && listener.OnSimObjectDataByType != nil { 240 | listener.OnSimObjectDataByType(&recvData) 241 | } 242 | 243 | // case RecvIDWeatherObservation: 244 | // case RecvIDCloudState: 245 | // case RecvIDAssignedObjectID: 246 | // case RecvIDReservedKey: 247 | // case RecvIDCustomAction: 248 | // case RecvIDSystemState: 249 | // case RecvIDClientData: 250 | // case RecvIDEventWeatherMode: 251 | // case RecvIDAirportList: 252 | // case RecvIDVORList: 253 | // case RecvIDNDBList: 254 | // case RecvIDWaypointList: 255 | // case RecvIDEventMultiplayerServerStarted: 256 | // case RecvIDEventMultiplayerClientStarted: 257 | // case RecvIDEventMultiplayerSessionEnded: 258 | // case RecvIDEventRaceEnd: 259 | // case RecvIDEventRaceLap: 260 | // case RecvIDPick: 261 | 262 | default: 263 | log.Tracef("Unknown recvInfo ID: %d", recv.ID) 264 | } 265 | } 266 | } 267 | } 268 | 269 | func (mate *SimMate) registerSimVars() (int, error) { 270 | count := 0 271 | for _, simVar := range mate.simVarManager.Vars { 272 | if !simVar.Registered { 273 | err := mate.AddToDataDefinition(simVar.DefineID, simVar.Name, simVar.Unit, simVar.DataType) 274 | if err != nil { 275 | return count, err 276 | } else { 277 | simVar.Registered = true 278 | count++ 279 | } 280 | } 281 | } 282 | return count, nil 283 | } 284 | 285 | func (mate *SimMate) requestSimObjectData() (bool, error) { 286 | mate.mutex.Lock() 287 | defer mate.mutex.Unlock() 288 | 289 | if mate.dirty { 290 | count, err := mate.registerSimVars() 291 | if err != nil { 292 | return false, err 293 | } 294 | if count > 0 { 295 | log.Tracef("Registered %d simvars", count) 296 | } 297 | mate.dirty = false 298 | } 299 | 300 | timestamp := time.Now().UnixNano() / int64(time.Millisecond) 301 | const radiusMeters = 0 302 | simObjectType := SimObjectTypeUser 303 | for _, simVar := range mate.simVarManager.Vars { 304 | if !simVar.Pending { 305 | simVar.RequestID = NewRequestID() 306 | } else { 307 | if timestamp-simVar.Timestamp < simVarRequestTimeout { 308 | continue 309 | } 310 | } 311 | mate.RequestDataOnSimObjectType(simVar.RequestID, simVar.DefineID, radiusMeters, simObjectType) 312 | simVar.Timestamp = timestamp 313 | simVar.Pending = true 314 | } 315 | return true, nil 316 | } 317 | 318 | func (mate *SimMate) updateSimObjectData(requestID, defineID DWord, value interface{}) { 319 | if simVar, updated := mate.simVarManager.Update(requestID, defineID, value); updated { 320 | simVar.Pending = false 321 | } 322 | } 323 | 324 | // Generics. Needed. Badly. Ugh. 325 | type SimObjectData struct { 326 | RecvSimObjectDataByType 327 | } 328 | 329 | type SimObjectData_int32 struct { 330 | SimObjectData 331 | Value int32 332 | } 333 | 334 | type SimObjectData_int64 struct { 335 | SimObjectData 336 | Value int64 337 | } 338 | 339 | type SimObjectData_float32 struct { 340 | SimObjectData 341 | Value float32 342 | } 343 | 344 | type SimObjectData_float64 struct { 345 | SimObjectData 346 | Value float64 347 | } 348 | 349 | type SimObjectData_string8 struct { 350 | SimObjectData 351 | Value [8]byte 352 | } 353 | 354 | type SimObjectData_string32 struct { 355 | SimObjectData 356 | Value [32]byte 357 | } 358 | 359 | type SimObjectData_string64 struct { 360 | SimObjectData 361 | Value [64]byte 362 | } 363 | 364 | type SimObjectData_string128 struct { 365 | SimObjectData 366 | Value [128]byte 367 | } 368 | 369 | type SimObjectData_string256 struct { 370 | SimObjectData 371 | Value [256]byte 372 | } 373 | 374 | type SimObjectData_string260 struct { 375 | SimObjectData 376 | Value [260]byte 377 | } 378 | 379 | type SimObjectData_stringv struct { 380 | SimObjectData 381 | Value string // TODO: Not sure if this is correct 382 | } 383 | -------------------------------------------------------------------------------- /simconnect/simvar.go: -------------------------------------------------------------------------------- 1 | package simconnect 2 | 3 | type SimVar struct { 4 | DefineID DWord 5 | RequestID DWord 6 | Name string 7 | Unit string 8 | DataType DWord 9 | Value interface{} 10 | UpdateCount int64 11 | IsString bool 12 | Registered bool 13 | Pending bool 14 | Timestamp int64 15 | } 16 | 17 | func NewSimVar(defineID DWord, name string, unit string, dataType DWord) *SimVar { 18 | return &SimVar{ 19 | DefineID: defineID, 20 | RequestID: 0, 21 | Name: name, 22 | Unit: unit, 23 | DataType: dataType, 24 | IsString: IsStringDataType(dataType), 25 | } 26 | } 27 | 28 | func (simVar *SimVar) ToInt32(defaultValue int32) int32 { 29 | if simVar.Value != nil { 30 | return ValueToInt32(simVar.Value) 31 | } 32 | return defaultValue 33 | } 34 | 35 | func (simVar *SimVar) ToInt64(defaultValue int64) int64 { 36 | if simVar.Value != nil { 37 | return ValueToInt64(simVar.Value) 38 | } 39 | return defaultValue 40 | } 41 | 42 | func (simVar *SimVar) ToFloat32(defaultValue float32) float32 { 43 | if simVar.Value != nil { 44 | return ValueToFloat32(simVar.Value) 45 | } 46 | return defaultValue 47 | } 48 | 49 | func (simVar *SimVar) ToFloat64(defaultValue float64) float64 { 50 | if simVar.Value != nil { 51 | return ValueToFloat64(simVar.Value) 52 | } 53 | return defaultValue 54 | } 55 | 56 | func (simVar *SimVar) ToString(defaultValue string) string { 57 | if simVar.Value != nil { 58 | return ValueToString(simVar.Value) 59 | } 60 | return defaultValue 61 | } 62 | -------------------------------------------------------------------------------- /simconnect/simvar_manager.go: -------------------------------------------------------------------------------- 1 | package simconnect 2 | 3 | import ( 4 | "bytes" 5 | "fmt" 6 | "sync" 7 | ) 8 | 9 | type SimVarManager struct { 10 | Vars []*SimVar 11 | nameMap map[string]*SimVar 12 | idMap map[DWord]*SimVar 13 | mutex sync.Mutex 14 | } 15 | 16 | func NewSimVarManager() *SimVarManager { 17 | return &SimVarManager{ 18 | Vars: make([]*SimVar, 0, 16), 19 | nameMap: make(map[string]*SimVar), 20 | idMap: make(map[DWord]*SimVar), 21 | } 22 | } 23 | 24 | func (mgr *SimVarManager) Count() int { 25 | mgr.mutex.Lock() 26 | defer mgr.mutex.Unlock() 27 | return len(mgr.nameMap) 28 | } 29 | 30 | func (mgr *SimVarManager) SimVars() []*SimVar { 31 | return mgr.Vars 32 | } 33 | 34 | func (mgr *SimVarManager) Add(name string, unit string, dataType DWord) DWord { 35 | mgr.mutex.Lock() 36 | defer mgr.mutex.Unlock() 37 | 38 | if simVar, exists := mgr.simVarWithName(name); exists { 39 | return simVar.DefineID 40 | } 41 | 42 | defineID := NewDefineID() 43 | simVar := NewSimVar(defineID, name, unit, dataType) 44 | mgr.Vars = append(mgr.Vars, simVar) 45 | mgr.nameMap[name] = simVar 46 | mgr.idMap[defineID] = simVar 47 | return defineID 48 | } 49 | 50 | func (mgr *SimVarManager) Remove(defineID DWord) bool { 51 | mgr.mutex.Lock() 52 | defer mgr.mutex.Unlock() 53 | simVar, exists := mgr.simVarWithID(defineID) 54 | if !exists { 55 | return false 56 | } 57 | delete(mgr.nameMap, simVar.Name) 58 | delete(mgr.idMap, simVar.DefineID) 59 | vars := mgr.Vars 60 | for i, simVar := range vars { 61 | if simVar.DefineID == defineID { 62 | vars[i] = vars[len(vars)-1] 63 | mgr.Vars = vars[:len(vars)-1] 64 | return true 65 | } 66 | } 67 | return false 68 | } 69 | 70 | func (mgr *SimVarManager) GetSimVar(defineID DWord) (*SimVar, bool) { 71 | mgr.mutex.Lock() 72 | defer mgr.mutex.Unlock() 73 | return mgr.simVarWithID(defineID) 74 | } 75 | 76 | func (mgr *SimVarManager) Update(requestID, defineID DWord, value interface{}) (*SimVar, bool) { 77 | mgr.mutex.Lock() 78 | defer mgr.mutex.Unlock() 79 | if simVar, ok := mgr.simVarWithID(defineID); ok { 80 | if simVar.Pending && simVar.RequestID == requestID { 81 | if !simVar.IsString { 82 | simVar.Value = value 83 | } else { 84 | simVar.Value = mgr.ToString(simVar.DataType, value) 85 | } 86 | simVar.UpdateCount++ 87 | return simVar, true 88 | } 89 | } 90 | return nil, false 91 | } 92 | 93 | func (mgr *SimVarManager) ToString(dataType DWord, value interface{}) string { 94 | switch dataType { 95 | case DataTypeString8: 96 | b := value.([8]byte) 97 | return string(bytes.Trim(b[:], "\x00")) 98 | 99 | case DataTypeString32: 100 | b := value.([32]byte) 101 | return string(bytes.Trim(b[:], "\x00")) 102 | 103 | case DataTypeString64: 104 | b := value.([64]byte) 105 | return string(bytes.Trim(b[:], "\x00")) 106 | 107 | case DataTypeString128: 108 | b := value.([128]byte) 109 | return string(bytes.Trim(b[:], "\x00")) 110 | 111 | case DataTypeString256: 112 | b := value.([256]byte) 113 | return string(bytes.Trim(b[:], "\x00")) 114 | 115 | case DataTypeString260: 116 | b := value.([260]byte) 117 | return string(bytes.Trim(b[:], "\x00")) 118 | } 119 | return fmt.Sprintf("%v", value) 120 | } 121 | 122 | func (mgr *SimVarManager) SimVarDump(indent string) []string { 123 | dump := make([]string, 0) 124 | for i, simVar := range mgr.Vars { 125 | str := fmt.Sprintf("%s%02d: name: %s unit: %s value: %v type: %s updates: %d reqId: %d defid: %d registered: %v pending: %v", 126 | indent, i+1, simVar.Name, simVar.Unit, simVar.Value, DataTypeToString(simVar.DataType), simVar.UpdateCount, 127 | simVar.RequestID, simVar.DefineID, simVar.Registered, simVar.Pending) 128 | dump = append(dump, str) 129 | } 130 | return dump 131 | } 132 | 133 | func (mgr *SimVarManager) simVarWithName(name string) (*SimVar, bool) { 134 | simVar, exists := mgr.nameMap[name] 135 | return simVar, exists 136 | } 137 | 138 | func (mgr *SimVarManager) simVarWithID(defineID DWord) (*SimVar, bool) { 139 | simVar, exists := mgr.idMap[defineID] 140 | return simVar, exists 141 | } 142 | -------------------------------------------------------------------------------- /simconnect/utils.go: -------------------------------------------------------------------------------- 1 | package simconnect 2 | 3 | var ( 4 | dataTypeMapper map[string]DWord 5 | ) 6 | 7 | func init() { 8 | dataTypeMapper = stringToDataTypeMapping() 9 | } 10 | 11 | func StringToDataType(dataType string) DWord { 12 | if value, exists := dataTypeMapper[dataType]; exists { 13 | return value 14 | } 15 | return DataTypeInvalid 16 | } 17 | 18 | func DataTypeToString(dataType DWord) string { 19 | for name, value := range dataTypeMapper { 20 | if value == dataType { 21 | return name 22 | } 23 | } 24 | return "invalid" 25 | } 26 | 27 | func IsStringDataType(dataType DWord) bool { 28 | switch dataType { 29 | case DataTypeString8, DataTypeString32, DataTypeString64, DataTypeString128, 30 | DataTypeString256, DataTypeString260, DataTypeStringV: 31 | return true 32 | } 33 | return false 34 | } 35 | 36 | func ValueToInt32(value interface{}) int32 { 37 | return value.(int32) 38 | } 39 | 40 | func ValueToInt64(value interface{}) int64 { 41 | return value.(int64) 42 | } 43 | 44 | func ValueToFloat32(value interface{}) float32 { 45 | return value.(float32) 46 | } 47 | 48 | func ValueToFloat64(value interface{}) float64 { 49 | return value.(float64) 50 | } 51 | 52 | func ValueToString(value interface{}) string { 53 | return value.(string) 54 | } 55 | 56 | func stringToDataTypeMapping() map[string]DWord { 57 | return map[string]DWord{ 58 | "invalid": DataTypeInvalid, 59 | "int32": DataTypeInt32, 60 | "int64": DataTypeInt64, 61 | "float32": DataTypeFloat32, 62 | "float64": DataTypeFloat64, 63 | "string8": DataTypeString8, 64 | "string32": DataTypeString32, 65 | "string64": DataTypeString64, 66 | "string128": DataTypeString128, 67 | "string256": DataTypeString256, 68 | "string260": DataTypeString260, 69 | "stringv": DataTypeStringV, 70 | "initposition": DataTypeInitPosition, 71 | "markerstate": DataTypeMarkerState, 72 | "waypoint": DataTypeWaypoint, 73 | "latlongalt": DataTypeLatLonAlt, 74 | "xyz": DataTypeXYZ, 75 | } 76 | } 77 | --------------------------------------------------------------------------------