├── .editorconfig ├── .gitignore ├── CMakeLists.txt ├── LICENSE ├── README.md ├── external └── SimConnect │ └── SimConnect.cfg ├── images ├── SimConnectInput-Parameters.png ├── SimConnectSink-Parameters.png ├── SimConnectSource-Parameters.png └── SimConnectToolboxExample.png ├── matlab ├── SimConnectToolbox.slx ├── SimConnectToolboxExample.slx └── slblocks.m ├── sim-connect-interface ├── CMakeLists.txt ├── examples │ ├── CMakeLists.txt │ ├── main-input.cpp │ ├── main-read.cpp │ └── main-write.cpp ├── include │ ├── MemoryAccessor.h │ ├── SimConnectData.h │ ├── SimConnectDataDefinition.h │ ├── SimConnectDataInterface.h │ ├── SimConnectInputInterface.h │ ├── SimConnectVariable.h │ ├── SimConnectVariableLookupTable.h │ ├── SimConnectVariableParser.h │ └── SimConnectVariableType.h └── src │ ├── SimConnectData.cpp │ ├── SimConnectDataDefinition.cpp │ ├── SimConnectDataInterface.cpp │ ├── SimConnectInputInterface.cpp │ └── SimConnectVariableLookupTable.cpp ├── simconnect-toolbox.prj └── src ├── Factory └── Factory.cpp ├── SimConnectInput ├── SimConnectInput.cpp └── SimConnectInput.h ├── SimConnectSink ├── SimConnectSink.cpp └── SimConnectSink.h └── SimConnectSource ├── SimConnectSource.cpp └── SimConnectSource.h /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | # indent_size = 4 7 | # indent_style = space 8 | # insert_final_newline = false 9 | # max_line_length = 120 10 | # tab_width = 4 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build/ 2 | cmake-build-*/ 3 | .vscode/ 4 | .idea/ 5 | .scannerwork/ 6 | bw-output/ 7 | 8 | CMakeLists.txt.user 9 | CMakeCache.txt 10 | CMakeFiles 11 | CMakeScripts 12 | Testing 13 | Makefile 14 | cmake_install.cmake 15 | install_manifest.txt 16 | compile_commands.json 17 | CTestTestfile.cmake 18 | _deps 19 | 20 | matlab/BlockFactory* 21 | matlab/*.dll 22 | matlab/*.cfg 23 | matlab/*.exe 24 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.17) 2 | project(SimConnectToolbox LANGUAGES CXX VERSION 1.0) 3 | 4 | set(CMAKE_CXX_STANDARD 17) 5 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 6 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 7 | 8 | set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) 9 | 10 | list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/../blockfactory/install") 11 | 12 | find_package( 13 | BlockFactory REQUIRED COMPONENTS Core Simulink 14 | ) 15 | 16 | include_directories( 17 | "$ENV{MSFS_SDK}/SimConnect SDK/include" 18 | ${CMAKE_SOURCE_DIR}/sim-connect-interface/include 19 | ${CMAKE_SOURCE_DIR}/src/SimConnectInput 20 | ${CMAKE_SOURCE_DIR}/src/SimConnectSink 21 | ${CMAKE_SOURCE_DIR}/src/SimConnectSource 22 | ) 23 | 24 | link_directories( 25 | "$ENV{MSFS_SDK}/SimConnect SDK/lib" 26 | ) 27 | 28 | add_definitions( 29 | -DWIN32_LEAN_AND_MEAN 30 | -DNOMINMAX 31 | -DNOGDI 32 | ) 33 | 34 | add_subdirectory(sim-connect-interface) 35 | add_subdirectory(sim-connect-interface/examples) 36 | 37 | add_library( 38 | SimConnectToolbox SHARED 39 | src/Factory/Factory.cpp 40 | src/SimConnectInput/SimConnectInput.cpp 41 | src/SimConnectInput/SimConnectInput.h 42 | src/SimConnectSink/SimConnectSink.cpp 43 | src/SimConnectSink/SimConnectSink.h 44 | src/SimConnectSource/SimConnectSource.cpp 45 | src/SimConnectSource/SimConnectSource.h 46 | ) 47 | 48 | set_target_properties( 49 | SimConnectToolbox PROPERTIES 50 | OUTPUT_NAME "SimConnectToolbox" 51 | ) 52 | 53 | target_link_libraries( 54 | SimConnectToolbox PRIVATE 55 | BlockFactory::Core 56 | SimConnectInterface 57 | SimConnect 58 | ) 59 | 60 | add_custom_command( 61 | TARGET SimConnectToolbox 62 | POST_BUILD 63 | COMMAND ${CMAKE_COMMAND} -E copy_if_different "$ENV{MSFS_SDK}/SimConnect SDK/lib/SimConnect.dll" "${CMAKE_SOURCE_DIR}/matlab" 64 | COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/external/SimConnect/SimConnect.cfg" "${CMAKE_SOURCE_DIR}/matlab" 65 | COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/../blockfactory/install/bin/BlockFactoryCore.dll" "${CMAKE_SOURCE_DIR}/matlab" 66 | COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/../blockfactory/install/bin/mxpp.dll" "${CMAKE_SOURCE_DIR}/matlab" 67 | COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/../blockfactory/install/bin/shlibpp.dll" "${CMAKE_SOURCE_DIR}/matlab" 68 | COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_SOURCE_DIR}/../blockfactory/install/mex/BlockFactory.mexw64" "${CMAKE_SOURCE_DIR}/matlab" 69 | COMMAND ${CMAKE_COMMAND} -E copy_if_different "$/SimConnectInterface.dll" "${CMAKE_SOURCE_DIR}/matlab" 70 | COMMAND ${CMAKE_COMMAND} -E copy_if_different "$/SimConnectToolbox.dll" "${CMAKE_SOURCE_DIR}/matlab" 71 | ) 72 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2020 Andreas Guther 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # simconnect-toolbox 2 | 3 | SimConnect Toolbox for MATLAB/Simulink 4 | 5 | This repository provides a Toolbox for MATLAB/Simulink with the following blocks: 6 | 7 | - SimConnectSource 8 | - SimConnectSink 9 | - SimConnectInput 10 | 11 | :warning: **The blocks only work properly using the solver *FixedStepDiscrete* (e.g. with step size `0.03`) and 12 | a *Simulation Pacing* set to `1`.** 13 | 14 | ## Building 15 | 16 | ### Prerequisites 17 | 18 | - Microsoft Visual Studio 2019 (e.g. Community Edition) 19 | - MATLAB / Simulink (tested with R2020b) 20 | - Microsoft Flight Simulator SDK 21 | - Blockfactory 22 | - CMake (tested with 3.18.4) 23 | 24 | ### Commands 25 | 26 | Ensure the environment variable `MSFS_SDK` is properly pointing to the MSFS SDK location. 27 | 28 | Use the following commands to get this repository and build it: 29 | 30 | ```lang-bash 31 | # download and build blockfactory 32 | git clone https://github.com/robotology/blockfactory.git 33 | cd blockfactory 34 | cmake -S . -B build 35 | cmake --build build --config Release 36 | cmake --install build --config Release --prefix install 37 | cd .. 38 | 39 | # download and build simconnect-toolbox 40 | git clone https://github.com/aguther/simconnect-toolbox.git 41 | cd simconnect-toolbox 42 | cmake -S . -B build 43 | cmake --build build --config Release 44 | ``` 45 | 46 | ### Usage 47 | 48 | In order to use the toolbox in MATLAB you need to do the following: 49 | - add the folder `/matlab` to MATLAB path 50 | - add the folder `/matlab` to the `PATH` environment variable of your user account (or system) 51 | 52 | :information_source: You can also put the content of directory `/matlab` to a location of your choice and do the steps described above for the new location. 53 | 54 | :warning: **When you do not add the directory to your PATH variable, you possibly will get an error when using one of the blocks, because Windows does not find the needed DLLs.** 55 | 56 | ## SimConnect Source & Sink 57 | 58 | This block allows to read/write data from/to SimConnect. 59 | 60 | The blocks have the following parameters: 61 | 62 | - Configuration Index 63 | - Connection Name 64 | - Variables 65 | 66 | ### Configuration Index 67 | 68 | The connection configuration index found in the `SimConnect.cfg`. 69 | 70 | ### Connection Name 71 | 72 | The name of the connection to be used when calling the SimConnect API. 73 | 74 | ### Variable specification 75 | 76 | Variables have to be in the following format: `VARIABLE NAME, UNIT;` 77 | 78 | The variable names and units can be found in the SimConnect SDK. 79 | 80 | :warning: Types with any string data type are not supported. 81 | 82 | Example: 83 | 84 | ```lang-none 85 | G FORCE, GFORCE; 86 | PLANE PITCH DEGREES, RADIANS; 87 | PLANE BANK DEGREES, RADIANS; 88 | AIRSPEED INDICATED, KNOTS; 89 | PLANE ALTITUDE, FEET; 90 | STRUCT WORLD ROTATION VELOCITY, STRUCT; 91 | LIGHT STROBE ON, BOOL; 92 | ``` 93 | 94 | ![SimConnectSource-Parameters](https://github.com/aguther/simconnect-toolbox/raw/main/images/SimConnectSource-Parameters.png "SimConnectSource-Parameters") 95 | ![SimConnectSink-Parameters](https://github.com/aguther/simconnect-toolbox/raw/main/images/SimConnectSink-Parameters.png "SimConnectSink-Parameters") 96 | 97 | #### Structs Types 98 | 99 | Struct types are provided / consumed as vector to Simulink. 100 | 101 | The following struct types are supported: 102 | 103 | - `SIMCONNECT_DATATYPE_LATLONALT` 104 | - `SIMCONNECT_DATATYPE_XYZ` 105 | 106 | ## SimConnect Input 107 | 108 | This block allows to read input event data from SimConnect. 109 | 110 | The block has the following parameters: 111 | 112 | - Configuration Index 113 | - Connection Name 114 | - Variables 115 | 116 | ### Configuration Index 117 | 118 | The connection configuration index found in the `SimConnect.cfg`. 119 | 120 | ### Connection Name 121 | 122 | The name of the connection to be used when calling the SimConnect API. 123 | 124 | ### Variable specification 125 | 126 | Variables have to be in the following format: `INPUT EVENT ID, SHOULD MASK;` 127 | 128 | The event ids can be found in the SimConnect SDK. The second parameter specifies if the event id should be 129 | forwarded to the sim or not. A value of `TRUE` will mask the event id meaning only the Simulink model will receive it. 130 | 131 | Example: 132 | 133 | ```lang-none 134 | AXIS_ELEVATOR_SET, TRUE; 135 | AXIS_AILERONS_SET, TRUE; 136 | AXIS_RUDDER_SET, FALSE; 137 | ``` 138 | 139 | The following input events are currently supported: 140 | 141 | - `AXIS_ELEVATOR_SET` 142 | - `AXIS_AILERONS_SET` 143 | - `AXIS_RUDDER_SET` 144 | - `AXIS_ELEV_TRIM_SET` 145 | - `AXIS_SPOILER_SET` 146 | - `AXIS_FLAPS_SET` 147 | - `AXIS_LEFT_BRAKE_SET` 148 | - `AXIS_RIGHT_BRAKE_SET` 149 | - `AXIS_THROTTLE_SET` 150 | - `AXIS_THROTTLE1_SET` 151 | - `AXIS_THROTTLE2_SET` 152 | - `AXIS_THROTTLE3_SET` 153 | - `AXIS_THROTTLE4_SET` 154 | - `AXIS_MIXTURE_SET` 155 | - `AXIS_MIXTURE1_SET` 156 | - `AXIS_MIXTURE2_SET` 157 | - `AXIS_MIXTURE3_SET` 158 | - `AXIS_MIXTURE4_SET` 159 | - `AXIS_PROPELLER_SET` 160 | - `AXIS_PROPELLER1_SET` 161 | - `AXIS_PROPELLER2_SET` 162 | - `AXIS_PROPELLER3_SET` 163 | - `AXIS_PROPELLER4_SET` 164 | 165 | :information_source: The range `[-16384, +16384]` is converted to `[-1.0, 1.0]`. 166 | 167 | ![SimConnectInput-Parameters](https://github.com/aguther/simconnect-toolbox/raw/main/images/SimConnectInput-Parameters.png "SimConnectInput-Parameters") 168 | 169 | ## Example Model 170 | 171 | This repository includes an example model `matlab/SimConnectToolboxExample.slx` that demonstrates the functionality. 172 | 173 | ![SimConnectToolboxExample](https://github.com/aguther/simconnect-toolbox/raw/main/images/SimConnectToolboxExample.png "SimConnectToolboxExample.slx") 174 | 175 | ## Open Points / Wishlist 176 | 177 | - Allow configuration index to be set via input 178 | - Improve parameter checking (distinguish between event ids and data variables) 179 | - Documentation of classes and methods 180 | 181 | ## Thank you notice 182 | 183 | A special thanks to: 184 | 185 | - Ferigo, Diego 186 | - Traversaro, Silvio 187 | - Romano, Francesco 188 | - Pucci, Daniele 189 | 190 | They provide a nice framework to make development of Simulink blocks an toolboxes easier and 191 | the code better understandable than using plain MATLAB/Simulink API. 192 | 193 | See also here: 194 | -------------------------------------------------------------------------------- /external/SimConnect/SimConnect.cfg: -------------------------------------------------------------------------------- 1 | ; Example SimConnect client configurations 2 | 3 | ; new FS pipe 4 | [SimConnect] 5 | Protocol=Pipe 6 | Port=Custom/SimConnect 7 | Address=127.0.0.1 8 | 9 | ; Automatic detection, backward compatible with FSX 10 | [SimConnect.1] 11 | Protocol=Auto 12 | Address= 13 | Port= 14 | MaxReceiveSize= 15 | DisableNagle= 16 | 17 | [SimConnect.2] 18 | Protocol=Ipv4 19 | Address= 20 | Port=500 21 | 22 | [SimConnect.3] 23 | Protocol=Ipv6 24 | Port=501 25 | Address= 26 | -------------------------------------------------------------------------------- /images/SimConnectInput-Parameters.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aguther/simconnect-toolbox/73b439ec156f4136211c9c2647aae2c0c0cc7e1a/images/SimConnectInput-Parameters.png -------------------------------------------------------------------------------- /images/SimConnectSink-Parameters.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aguther/simconnect-toolbox/73b439ec156f4136211c9c2647aae2c0c0cc7e1a/images/SimConnectSink-Parameters.png -------------------------------------------------------------------------------- /images/SimConnectSource-Parameters.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aguther/simconnect-toolbox/73b439ec156f4136211c9c2647aae2c0c0cc7e1a/images/SimConnectSource-Parameters.png -------------------------------------------------------------------------------- /images/SimConnectToolboxExample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aguther/simconnect-toolbox/73b439ec156f4136211c9c2647aae2c0c0cc7e1a/images/SimConnectToolboxExample.png -------------------------------------------------------------------------------- /matlab/SimConnectToolbox.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aguther/simconnect-toolbox/73b439ec156f4136211c9c2647aae2c0c0cc7e1a/matlab/SimConnectToolbox.slx -------------------------------------------------------------------------------- /matlab/SimConnectToolboxExample.slx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aguther/simconnect-toolbox/73b439ec156f4136211c9c2647aae2c0c0cc7e1a/matlab/SimConnectToolboxExample.slx -------------------------------------------------------------------------------- /matlab/slblocks.m: -------------------------------------------------------------------------------- 1 | function blkStruct = slblocks 2 | 3 | Browser.Library = 'SimConnectToolbox'; 4 | Browser.Name = 'SimConnect Toolbox'; 5 | Browser.IsFlat = 0; 6 | 7 | blkStruct.Browser = Browser; 8 | -------------------------------------------------------------------------------- /sim-connect-interface/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | include_directories( 2 | "$ENV{MSFS_SDK}/SimConnect SDK/include" 3 | "${CMAKE_CURRENT_SOURCE_DIR}/include" 4 | ) 5 | 6 | link_directories( 7 | "$ENV{MSFS_SDK}/SimConnect SDK/lib" 8 | ) 9 | 10 | add_definitions( 11 | -DWIN32_LEAN_AND_MEAN 12 | -DNOMINMAX 13 | -DNOGDI 14 | ) 15 | 16 | add_library( 17 | SimConnectInterface SHARED 18 | include/MemoryAccessor.h 19 | include/SimConnectData.h 20 | include/SimConnectDataDefinition.h 21 | include/SimConnectDataInterface.h 22 | include/SimConnectInputInterface.h 23 | include/SimConnectVariable.h 24 | include/SimConnectVariableLookupTable.h 25 | include/SimConnectVariableParser.h 26 | include/SimConnectVariableType.h 27 | src/SimConnectData.cpp 28 | src/SimConnectDataDefinition.cpp 29 | src/SimConnectDataInterface.cpp 30 | src/SimConnectInputInterface.cpp 31 | src/SimConnectVariableLookupTable.cpp 32 | ) 33 | 34 | target_link_libraries( 35 | SimConnectInterface PRIVATE 36 | SimConnect 37 | ) 38 | 39 | add_custom_command( 40 | TARGET SimConnectInterface 41 | POST_BUILD 42 | COMMAND ${CMAKE_COMMAND} -E copy_if_different "$/SimConnectInterface.dll" "${CMAKE_SOURCE_DIR}/matlab" 43 | ) 44 | -------------------------------------------------------------------------------- /sim-connect-interface/examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | include_directories( 3 | "$ENV{MSFS_SDK}/SimConnect SDK/include" 4 | "${CMAKE_CURRENT_SOURCE_DIR}/../include" 5 | ) 6 | 7 | # ---------------------- SimConnectTestRead ----------------------------------- 8 | 9 | add_executable( 10 | SimConnectTestRead 11 | main-read.cpp 12 | ) 13 | set_target_properties( 14 | SimConnectTestRead PROPERTIES 15 | EXCLUDE_FROM_ALL TRUE 16 | ) 17 | target_link_libraries( 18 | SimConnectTestRead PRIVATE 19 | SimConnectInterface 20 | SimConnect 21 | ) 22 | add_custom_command( 23 | TARGET SimConnectTestRead 24 | POST_BUILD 25 | COMMAND ${CMAKE_COMMAND} -E copy_if_different "$/SimConnectTestRead.exe" "${CMAKE_SOURCE_DIR}/matlab" 26 | ) 27 | 28 | # ---------------------- SimConnectTestWrite ---------------------------------- 29 | 30 | add_executable( 31 | SimConnectTestWrite 32 | main-write.cpp 33 | ) 34 | set_target_properties( 35 | SimConnectTestWrite PROPERTIES 36 | EXCLUDE_FROM_ALL TRUE 37 | ) 38 | target_link_libraries( 39 | SimConnectTestWrite PRIVATE 40 | SimConnectInterface 41 | SimConnect 42 | ) 43 | add_custom_command( 44 | TARGET SimConnectTestWrite 45 | POST_BUILD 46 | COMMAND ${CMAKE_COMMAND} -E copy_if_different "$/SimConnectTestWrite.exe" "${CMAKE_SOURCE_DIR}/matlab" 47 | ) 48 | 49 | # ---------------------- SimConnectTestInput ---------------------------------- 50 | 51 | add_executable( 52 | SimConnectTestInput 53 | main-input.cpp 54 | ) 55 | 56 | set_target_properties( 57 | SimConnectTestInput PROPERTIES 58 | EXCLUDE_FROM_ALL TRUE 59 | ) 60 | 61 | target_link_libraries( 62 | SimConnectTestInput PRIVATE 63 | SimConnectInterface 64 | SimConnect 65 | ) 66 | 67 | add_custom_command( 68 | TARGET SimConnectTestRead 69 | POST_BUILD 70 | COMMAND ${CMAKE_COMMAND} -E copy_if_different "$/SimConnectTestInput.exe" "${CMAKE_SOURCE_DIR}/matlab" 71 | ) 72 | -------------------------------------------------------------------------------- /sim-connect-interface/examples/main-input.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Andreas Guther 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | using namespace std; 26 | using namespace simconnect::toolbox::connection; 27 | 28 | int main() { 29 | // data definition defines what to read / write 30 | auto dataDefinition = SimConnectDataDefinition(); 31 | // add variables to definition 32 | dataDefinition.add(SimConnectVariable("AXIS_ELEVATOR_SET", "TRUE")); 33 | dataDefinition.add(SimConnectVariable("AXIS_AILERONS_SET", "FALSE")); 34 | // create data object holding the actual data 35 | auto simConnectData = make_shared(dataDefinition); 36 | 37 | // connect to sim 38 | SimConnectInputInterface simConnectInterface; 39 | bool connected = simConnectInterface.connect( 40 | 0, 41 | "example-input", 42 | dataDefinition, 43 | simConnectData 44 | ); 45 | cout << connected << endl; 46 | 47 | while (simConnectInterface.readData()) { 48 | for (int kI = 0; kI < dataDefinition.size(); ++kI) { 49 | switch (dataDefinition.getType(kI)) { 50 | case SIMCONNECT_VARIABLE_TYPE_FLOAT64: 51 | cout << dataDefinition.get(kI).name << ": "; 52 | cout << any_cast(simConnectData->get(kI)) << " "; 53 | break; 54 | default: 55 | break; 56 | } 57 | } 58 | cout << endl; 59 | this_thread::sleep_for(chrono::milliseconds(500)); 60 | } 61 | 62 | return 0; 63 | } 64 | -------------------------------------------------------------------------------- /sim-connect-interface/examples/main-read.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Andreas Guther 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | using namespace std; 27 | using namespace simconnect::toolbox::connection; 28 | 29 | int main() { 30 | // data definition defines what to read / write 31 | auto dataDefinition = SimConnectDataDefinition(); 32 | // add variables to definition 33 | dataDefinition.add(SimConnectVariable("G FORCE", "GFORCE")); 34 | dataDefinition.add(SimConnectVariable("PLANE ALTITUDE", "FEET")); 35 | dataDefinition.add(SimConnectVariable("STRUCT WORLD ROTATION VELOCITY", "SIMCONNECT_DATA_XYZ")); 36 | dataDefinition.add(SimConnectVariable("LIGHT LANDING ON", "BOOL")); 37 | dataDefinition.add(SimConnectVariable("TURB ENG N1:1", "PERCENT")); 38 | 39 | // create data object holding the actual data 40 | auto simConnectData = make_shared(dataDefinition); 41 | 42 | // connect to sim 43 | SimConnectDataInterface simConnectInterface; 44 | bool connected = simConnectInterface.connect( 45 | 0, 46 | "example-read", 47 | dataDefinition, 48 | simConnectData 49 | ); 50 | cout << connected << endl; 51 | 52 | while (simConnectInterface.requestReadData()) { 53 | for (int kI = 0; kI < dataDefinition.size(); ++kI) { 54 | switch (dataDefinition.getType(kI)) { 55 | case SIMCONNECT_VARIABLE_TYPE_BOOL: 56 | cout << dataDefinition.get(kI).name << ": "; 57 | cout << any_cast(simConnectData->get(kI)) << " "; 58 | break; 59 | case SIMCONNECT_VARIABLE_TYPE_INT32: 60 | cout << dataDefinition.get(kI).name << ": "; 61 | cout << any_cast(simConnectData->get(kI)) << " "; 62 | break; 63 | case SIMCONNECT_VARIABLE_TYPE_FLOAT32: 64 | cout << dataDefinition.get(kI).name << ": "; 65 | cout << any_cast(simConnectData->get(kI)) << " "; 66 | break; 67 | case SIMCONNECT_VARIABLE_TYPE_FLOAT64: 68 | cout << dataDefinition.get(kI).name << ": "; 69 | cout << any_cast(simConnectData->get(kI)) << " "; 70 | break; 71 | case SIMCONNECT_VARIABLE_TYPE_LATLONALT: 72 | cout << dataDefinition.get(kI).name << ": "; 73 | cout << any_cast(simConnectData->get(kI)).Latitude << ","; 74 | cout << any_cast(simConnectData->get(kI)).Longitude << ","; 75 | cout << any_cast(simConnectData->get(kI)).Altitude << " "; 76 | break; 77 | case SIMCONNECT_VARIABLE_TYPE_XYZ: 78 | cout << dataDefinition.get(kI).name << ": "; 79 | cout << any_cast(simConnectData->get(kI)).x << ","; 80 | cout << any_cast(simConnectData->get(kI)).y << ","; 81 | cout << any_cast(simConnectData->get(kI)).z << " "; 82 | break; 83 | default: 84 | break; 85 | } 86 | } 87 | cout << endl; 88 | this_thread::sleep_for(chrono::milliseconds(500)); 89 | } 90 | 91 | return 0; 92 | } 93 | -------------------------------------------------------------------------------- /sim-connect-interface/examples/main-write.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Andreas Guther 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | using namespace std; 26 | using namespace simconnect::toolbox::connection; 27 | 28 | int main() { 29 | // data definition defines what to read / write 30 | auto dataDefinition = SimConnectDataDefinition(); 31 | // add variables to definition 32 | dataDefinition.add(SimConnectVariable("RUDDER TRIM PCT", "Percent Over 100")); 33 | // create data object holding the actual data 34 | auto simConnectData = make_shared(dataDefinition); 35 | 36 | // connect to sim 37 | SimConnectDataInterface simConnectInterface; 38 | bool connected = simConnectInterface.connect( 39 | 0, 40 | "example-write", 41 | dataDefinition, 42 | simConnectData 43 | ); 44 | cout << connected << endl; 45 | 46 | bool lightOn = false; 47 | unsigned int runningIndex = 0; 48 | 49 | while (true) { 50 | if (runningIndex++ % 5 == 0) { 51 | lightOn = !lightOn; 52 | } 53 | 54 | simConnectData->set(0, lightOn ? -1.0 : 1.0); 55 | if (simConnectInterface.sendData()) { 56 | cout << "Success writing" << endl; 57 | } else { 58 | cout << "Failed writing" << endl; 59 | } 60 | 61 | this_thread::sleep_for(chrono::milliseconds(500)); 62 | } 63 | 64 | return 0; 65 | } 66 | -------------------------------------------------------------------------------- /sim-connect-interface/include/MemoryAccessor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Andreas Guther 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | 22 | template 23 | class MemoryAccessor { 24 | public: 25 | MemoryAccessor( 26 | char *_data, 27 | size_t _count 28 | ); 29 | 30 | size_t getCount(); 31 | 32 | T get( 33 | size_t index 34 | ) const; 35 | 36 | void set( 37 | size_t index, 38 | T value 39 | ); 40 | 41 | static size_t getSizeWithPadding( 42 | size_t _count, 43 | size_t _alignment 44 | ); 45 | 46 | static size_t getSize( 47 | size_t _count 48 | ); 49 | 50 | static size_t getPadding( 51 | size_t _count, 52 | size_t _alignment 53 | ); 54 | 55 | private: 56 | T *data = nullptr; 57 | size_t count = 0; 58 | }; 59 | 60 | template 61 | MemoryAccessor::MemoryAccessor( 62 | char *_data, 63 | const size_t _count 64 | ) { 65 | data = reinterpret_cast(_data); 66 | count = _count; 67 | } 68 | 69 | template 70 | size_t MemoryAccessor::getCount() { 71 | return count; 72 | } 73 | 74 | template 75 | T MemoryAccessor::get( 76 | size_t index 77 | ) const { 78 | if (index >= count) { 79 | throw std::out_of_range("Index is out of range!"); 80 | } 81 | return data[index]; 82 | } 83 | 84 | template 85 | void MemoryAccessor::set( 86 | size_t index, 87 | T value 88 | ) { 89 | if (index >= count) { 90 | throw std::out_of_range("Index is out of range!"); 91 | } 92 | data[index] = value; 93 | } 94 | 95 | template 96 | size_t MemoryAccessor::getSizeWithPadding( 97 | const size_t _count, 98 | const size_t _alignment 99 | ) { 100 | return getSize(_count) + getPadding(_count, _alignment); 101 | } 102 | 103 | template 104 | size_t MemoryAccessor::getSize( 105 | const size_t _count 106 | ) { 107 | // variable for size 108 | size_t size = 0; 109 | // add size of doubles 110 | size += _count * sizeof(T); 111 | // return result 112 | return size; 113 | } 114 | 115 | template 116 | size_t MemoryAccessor::getPadding( 117 | const size_t _count, 118 | const size_t _alignment 119 | ) { 120 | // return result 121 | return (_alignment - (getSize(_count) % _alignment)) % _alignment; 122 | } 123 | -------------------------------------------------------------------------------- /sim-connect-interface/include/SimConnectData.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Andreas Guther 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include "MemoryAccessor.h" 24 | #include "SimConnectDataDefinition.h" 25 | 26 | namespace simconnect::toolbox::connection { 27 | class SimConnectData; 28 | } 29 | 30 | class simconnect::toolbox::connection::SimConnectData { 31 | public: 32 | explicit SimConnectData( 33 | const SimConnectDataDefinition &dataDefinition 34 | ); 35 | 36 | ~SimConnectData(); 37 | 38 | [[nodiscard]] size_t size() const; 39 | 40 | char *getBuffer(); 41 | 42 | std::any get( 43 | size_t index 44 | ); 45 | 46 | void set( 47 | size_t index, 48 | std::any value 49 | ); 50 | 51 | void copy( 52 | char *pBuffer 53 | ); 54 | 55 | private: 56 | struct MemberCount { 57 | size_t countBoolean = 0; 58 | size_t countInt32 = 0; 59 | size_t countFloat32 = 0; 60 | size_t countFloat64 = 0; 61 | size_t countLatLonAlt = 0; 62 | size_t countXYZ = 0; 63 | }; 64 | 65 | SimConnectDataDefinition dataDefinition; 66 | std::deque indexMapping; 67 | MemberCount memberCount = {}; 68 | 69 | size_t totalSize = 0; 70 | char *buffer = nullptr; 71 | 72 | std::shared_ptr> memoryAccessorBoolean = nullptr; 73 | std::shared_ptr> memoryAccessorInt32 = nullptr; 74 | std::shared_ptr> memoryAccessorFloat32 = nullptr; 75 | std::shared_ptr> memoryAccessorFloat64 = nullptr; 76 | std::shared_ptr> memoryAccessorLatLonAlt = nullptr; 77 | std::shared_ptr> memoryAccessorXYZ = nullptr; 78 | 79 | MemberCount getMemberCountFromDataDefinition( 80 | SimConnectDataDefinition _dataDefinition 81 | ); 82 | 83 | static size_t getTotalSize( 84 | MemberCount counts 85 | ); 86 | 87 | void setupMemoryAccessors(); 88 | }; 89 | -------------------------------------------------------------------------------- /sim-connect-interface/include/SimConnectDataDefinition.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Andreas Guther 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include "SimConnectVariable.h" 24 | #include "SimConnectVariableLookupTable.h" 25 | 26 | namespace simconnect::toolbox::connection { 27 | class SimConnectDataDefinition; 28 | } 29 | 30 | class simconnect::toolbox::connection::SimConnectDataDefinition { 31 | public: 32 | explicit SimConnectDataDefinition(); 33 | 34 | SimConnectDataDefinition( 35 | const SimConnectDataDefinition &other 36 | ); 37 | 38 | SimConnectDataDefinition &operator=( 39 | const SimConnectDataDefinition &other 40 | ); 41 | 42 | ~SimConnectDataDefinition(); 43 | 44 | void add( 45 | const SimConnectVariable &item 46 | ); 47 | 48 | SimConnectVariable get( 49 | size_t index 50 | ); 51 | 52 | size_t size(); 53 | 54 | SIMCONNECT_VARIABLE_TYPE getType( 55 | size_t index 56 | ); 57 | 58 | SIMCONNECT_VARIABLE_TYPE getType( 59 | const SimConnectVariable &item 60 | ); 61 | 62 | private: 63 | std::deque variables; 64 | }; 65 | -------------------------------------------------------------------------------- /sim-connect-interface/include/SimConnectDataInterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Andreas Guther 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include "SimConnectDataDefinition.h" 24 | #include "SimConnectData.h" 25 | 26 | namespace simconnect::toolbox::connection { 27 | class SimConnectDataInterface; 28 | } 29 | 30 | class simconnect::toolbox::connection::SimConnectDataInterface { 31 | public: 32 | SimConnectDataInterface() = default; 33 | 34 | ~SimConnectDataInterface() = default; 35 | 36 | bool connect( 37 | int configurationIndex, 38 | const std::string &name, 39 | const SimConnectDataDefinition &dataDefinition, 40 | const std::shared_ptr &simConnectData 41 | ); 42 | 43 | void disconnect(); 44 | 45 | bool requestReadData(); 46 | 47 | bool requestData(); 48 | 49 | bool readData(); 50 | 51 | bool sendData(); 52 | 53 | private: 54 | bool isConnected = false; 55 | HANDLE hSimConnect = nullptr; 56 | std::string connectionName; 57 | std::shared_ptr data; 58 | 59 | void simConnectProcessDispatchMessage( 60 | SIMCONNECT_RECV *pData, 61 | DWORD *cbData 62 | ); 63 | 64 | void simConnectProcessSimObjectDataByType( 65 | const SIMCONNECT_RECV *pData 66 | ); 67 | 68 | static bool prepareDataDefinition( 69 | HANDLE connectionHandle, 70 | SIMCONNECT_DATA_DEFINITION_ID id, 71 | SimConnectDataDefinition dataDefinition 72 | ); 73 | 74 | static bool addDataDefinition( 75 | HANDLE connectionHandle, 76 | SIMCONNECT_DATA_DEFINITION_ID id, 77 | SIMCONNECT_VARIABLE_TYPE dataType, 78 | const std::vector &variables 79 | ); 80 | }; 81 | -------------------------------------------------------------------------------- /sim-connect-interface/include/SimConnectInputInterface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Andreas Guther 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include "SimConnectDataDefinition.h" 24 | #include "SimConnectData.h" 25 | 26 | namespace simconnect::toolbox::connection { 27 | class SimConnectInputInterface; 28 | } 29 | 30 | class simconnect::toolbox::connection::SimConnectInputInterface { 31 | public: 32 | SimConnectInputInterface() = default; 33 | 34 | ~SimConnectInputInterface() = default; 35 | 36 | bool connect( 37 | int configurationIndex, 38 | const std::string &name, 39 | const SimConnectDataDefinition &dataDefinition, 40 | const std::shared_ptr &simConnectData, 41 | DWORD priority = SIMCONNECT_GROUP_PRIORITY_HIGHEST_MASKABLE 42 | ); 43 | 44 | void disconnect(); 45 | 46 | bool readData(); 47 | 48 | private: 49 | bool isConnected = false; 50 | HANDLE hSimConnect = nullptr; 51 | std::string connectionName; 52 | std::shared_ptr data; 53 | 54 | void simConnectProcessDispatchMessage( 55 | SIMCONNECT_RECV *pData, 56 | DWORD *cbData 57 | ); 58 | 59 | void simConnectProcessEvent( 60 | const SIMCONNECT_RECV *pData 61 | ); 62 | 63 | static bool prepareDataDefinition( 64 | HANDLE connectionHandle, 65 | SIMCONNECT_DATA_DEFINITION_ID id, 66 | SimConnectDataDefinition dataDefinition, 67 | DWORD priority 68 | ); 69 | 70 | static bool addDataDefinition( 71 | HANDLE connectionHandle, 72 | SIMCONNECT_DATA_DEFINITION_ID groupId, 73 | SIMCONNECT_CLIENT_EVENT_ID eventId, 74 | const SimConnectVariable &variable, 75 | DWORD priority 76 | ); 77 | }; 78 | -------------------------------------------------------------------------------- /sim-connect-interface/include/SimConnectVariable.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Andreas Guther 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | namespace simconnect::toolbox::connection { 24 | class SimConnectVariable; 25 | } 26 | 27 | class simconnect::toolbox::connection::SimConnectVariable { 28 | public: 29 | SimConnectVariable( 30 | std::string name, 31 | std::string unit 32 | ) : name(move(name)), unit(move(unit)) { 33 | transform(this->name.begin(), this->name.end(), this->name.begin(), ::toupper); 34 | transform(this->unit.begin(), this->unit.end(), this->unit.begin(), ::toupper); 35 | } 36 | 37 | ~SimConnectVariable() = default; 38 | 39 | std::string name; 40 | std::string unit; 41 | }; 42 | -------------------------------------------------------------------------------- /sim-connect-interface/include/SimConnectVariableLookupTable.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Andreas Guther 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include "SimConnectVariable.h" 24 | #include "SimConnectVariableType.h" 25 | 26 | namespace simconnect::toolbox::connection { 27 | class SimConnectVariableLookupTable; 28 | } 29 | 30 | class simconnect::toolbox::connection::SimConnectVariableLookupTable { 31 | public: 32 | SimConnectVariableLookupTable( 33 | SimConnectVariableLookupTable const & 34 | ) = delete; 35 | 36 | void operator=( 37 | SimConnectVariableLookupTable const & 38 | ) = delete; 39 | 40 | static bool isLvar( 41 | const SimConnectVariable &item 42 | ); 43 | 44 | static bool isKnown( 45 | const SimConnectVariable &item 46 | ); 47 | 48 | static SIMCONNECT_VARIABLE_TYPE getDataType( 49 | const SimConnectVariable &item 50 | ); 51 | 52 | private: 53 | SimConnectVariableLookupTable() = default; 54 | 55 | ~SimConnectVariableLookupTable() = default; 56 | 57 | static std::string normalizeName(const std::string& itemName); 58 | 59 | inline static const std::map LOOKUP_TABLE = { 60 | {"AUTOPILOT PITCH HOLD", SIMCONNECT_VARIABLE_TYPE_BOOL}, 61 | {"STRUCT AMBIENT WIND", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 62 | {"LAUNCHBAR POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 63 | {"NUMBER OF CATAPULTS", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 64 | {"HOLDBACK BAR INSTALLED", SIMCONNECT_VARIABLE_TYPE_BOOL}, 65 | {"BLAST SHIELD POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 66 | {"RECIP ENG DETONATING", SIMCONNECT_VARIABLE_TYPE_BOOL}, 67 | {"RECIP ENG CYLINDER HEALTH", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 68 | {"RECIP ENG NUM CYLINDERS", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 69 | {"RECIP ENG NUM CYLINDERS FAILED", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 70 | {"RECIP ENG ANTIDETONATION TANK VALVE", SIMCONNECT_VARIABLE_TYPE_INT32}, 71 | {"RECIP ENG ANTIDETONATION TANK QUANTITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 72 | {"RECIP ENG ANTIDETONATION TANK MAX QUANTITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 73 | {"RECIP ENG NITROUS TANK VALVE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 74 | {"RECIP ENG NITROUS TANK QUANTITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 75 | {"RECIP ENG NITROUS TANK MAX QUANTITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 76 | {"PAYLOAD STATION NUM SIMOBJECTS", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 77 | {"SLING CABLE BROKEN", SIMCONNECT_VARIABLE_TYPE_BOOL}, 78 | {"SLING CABLE EXTENDED LENGTH", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 79 | {"SLING ACTIVE PAYLOAD STATION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 80 | {"SLING HOIST PERCENT DEPLOYED", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 81 | {"SLING HOOK IN PICKUP MODE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 82 | {"IS ATTACHED TO SLING", SIMCONNECT_VARIABLE_TYPE_BOOL}, 83 | {"ALTERNATE STATIC SOURCE OPEN", SIMCONNECT_VARIABLE_TYPE_BOOL}, 84 | {"AILERON TRIM PCT", SIMCONNECT_VARIABLE_TYPE_XYZ}, 85 | {"RUDDER TRIM PCT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 86 | {"LANDING LIGHT PBH", SIMCONNECT_VARIABLE_TYPE_XYZ}, 87 | {"LIGHT TAXI ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 88 | {"LIGHT STROBE ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 89 | {"LIGHT PANEL ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 90 | {"LIGHT RECOGNITION ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 91 | {"LIGHT WING ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 92 | {"LIGHT LOGO ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 93 | {"LIGHT CABIN ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 94 | {"LIGHT HEAD ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 95 | {"LIGHT BRAKE ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 96 | {"LIGHT NAV ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 97 | {"LIGHT BEACON ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 98 | {"LIGHT LANDING ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 99 | {"AI DESIRED SPEED", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 100 | {"AI CURRENT WAYPOINT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 101 | {"AI DESIRED HEADING", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 102 | {"AI GROUNDTURNTIME", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 103 | {"AI GROUNDCRUISESPEED", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 104 | {"AI GROUNDTURNSPEED", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 105 | {"AI TRAFFIC ISIFR", SIMCONNECT_VARIABLE_TYPE_BOOL}, 106 | {"AI TRAFFIC ETD", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 107 | {"AI TRAFFIC ETA", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 108 | {"DROPPABLE OBJECTS COUNT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 109 | {"WING FLEX PCT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 110 | {"APPLY HEAT TO SYSTEMS", SIMCONNECT_VARIABLE_TYPE_BOOL}, 111 | {"ADF LATLONALT", SIMCONNECT_VARIABLE_TYPE_LATLONALT}, 112 | {"NAV VOR LATLONALT", SIMCONNECT_VARIABLE_TYPE_LATLONALT}, 113 | {"NAV GS LATLONALT", SIMCONNECT_VARIABLE_TYPE_LATLONALT}, 114 | {"NAV DME LATLONALT", SIMCONNECT_VARIABLE_TYPE_LATLONALT}, 115 | {"INNER MARKER LATLONALT", SIMCONNECT_VARIABLE_TYPE_LATLONALT}, 116 | {"MIDDLE MARKER LATLONALT", SIMCONNECT_VARIABLE_TYPE_LATLONALT}, 117 | {"OUTER MARKER LATLONALT", SIMCONNECT_VARIABLE_TYPE_LATLONALT}, 118 | {"STRUCT LATLONALT", SIMCONNECT_VARIABLE_TYPE_LATLONALT}, 119 | {"STRUCT LATLONALTPBH", SIMCONNECT_VARIABLE_TYPE_LATLONALT}, 120 | {"STRUCT SURFACE RELATIVE VELOCITY", SIMCONNECT_VARIABLE_TYPE_XYZ}, 121 | {"STRUCT WORLDVELOCITY", SIMCONNECT_VARIABLE_TYPE_XYZ}, 122 | {"STRUCT WORLD ROTATION VELOCITY", SIMCONNECT_VARIABLE_TYPE_XYZ}, 123 | {"STRUCT BODY VELOCITY", SIMCONNECT_VARIABLE_TYPE_XYZ}, 124 | {"STRUCT BODY ROTATION VELOCITY", SIMCONNECT_VARIABLE_TYPE_XYZ}, 125 | {"STRUCT BODY ROTATION ACCELERATION", SIMCONNECT_VARIABLE_TYPE_XYZ}, 126 | {"STRUCT WORLD ACCELERATION", SIMCONNECT_VARIABLE_TYPE_XYZ}, 127 | {"STRUCT ENGINE POSITION", SIMCONNECT_VARIABLE_TYPE_XYZ}, 128 | {"STRUCT EYEPOINT DYNAMIC ANGLE", SIMCONNECT_VARIABLE_TYPE_XYZ}, 129 | {"STRUCT EYEPOINT DYNAMIC OFFSET", SIMCONNECT_VARIABLE_TYPE_XYZ}, 130 | {"EYEPOINT POSITION", SIMCONNECT_VARIABLE_TYPE_XYZ}, 131 | {"FLY BY WIRE ELAC SWITCH", SIMCONNECT_VARIABLE_TYPE_BOOL}, 132 | {"FLY BY WIRE FAC SWITCH", SIMCONNECT_VARIABLE_TYPE_BOOL}, 133 | {"FLY BY WIRE SEC SWITCH", SIMCONNECT_VARIABLE_TYPE_BOOL}, 134 | {"FLY BY WIRE ELAC FAILED", SIMCONNECT_VARIABLE_TYPE_BOOL}, 135 | {"FLY BY WIRE FAC FAILED", SIMCONNECT_VARIABLE_TYPE_BOOL}, 136 | {"FLY BY WIRE SEC FAILED", SIMCONNECT_VARIABLE_TYPE_BOOL}, 137 | {"NUMBER OF ENGINES", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 138 | {"THROTTLE LOWER LIMIT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 139 | {"ENGINE TYPE", SIMCONNECT_VARIABLE_TYPE_INT32}, 140 | {"MASTER IGNITION SWITCH", SIMCONNECT_VARIABLE_TYPE_BOOL}, 141 | {"GENERAL ENG COMBUSTION", SIMCONNECT_VARIABLE_TYPE_BOOL}, 142 | {"GENERAL ENG MASTER ALTERNATOR", SIMCONNECT_VARIABLE_TYPE_BOOL}, 143 | {"GENERAL ENG FUEL PUMP SWITCH", SIMCONNECT_VARIABLE_TYPE_BOOL}, 144 | {"GENERAL ENG FUEL PUMP ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 145 | {"GENERAL ENG RPM", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 146 | {"GENERAL ENG PCT MAX RPM", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 147 | {"GENERAL ENG MAX REACHED RPM", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 148 | {"GENERAL ENG THROTTLE LEVER POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 149 | {"GENERAL ENG THROTTLE MANAGED MODE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 150 | {"GENERAL ENG MIXTURE LEVER POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 151 | {"GENERAL ENG PROPELLER LEVER POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 152 | {"GENERAL ENG STARTER", SIMCONNECT_VARIABLE_TYPE_BOOL}, 153 | {"GENERAL ENG EXHAUST GAS TEMPERATURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 154 | {"GENERAL ENG OIL PRESSURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 155 | {"GENERAL ENG OIL LEAKED PERCENT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 156 | {"GENERAL ENG COMBUSTION SOUND PERCENT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 157 | {"GENERAL ENG DAMAGE PERCENT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 158 | {"GENERAL ENG OIL TEMPERATURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 159 | {"GENERAL ENG FAILED", SIMCONNECT_VARIABLE_TYPE_BOOL}, 160 | {"GENERAL ENG GENERATOR SWITCH", SIMCONNECT_VARIABLE_TYPE_BOOL}, 161 | {"GENERAL ENG GENERATOR ACTIVE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 162 | {"GENERAL ENG ANTI ICE POSITION", SIMCONNECT_VARIABLE_TYPE_BOOL}, 163 | {"GENERAL ENG FUEL VALVE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 164 | {"GENERAL ENG FUEL PRESSURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 165 | {"GENERAL ENG ELAPSED TIME", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 166 | {"RECIP ENG COWL FLAP POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 167 | {"RECIP ENG PRIMER", SIMCONNECT_VARIABLE_TYPE_BOOL}, 168 | {"RECIP ENG MANIFOLD PRESSURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 169 | {"RECIP ENG ALTERNATE AIR POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 170 | {"RECIP ENG COOLANT RESERVOIR PERCENT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 171 | {"RECIP ENG LEFT MAGNETO", SIMCONNECT_VARIABLE_TYPE_BOOL}, 172 | {"RECIP ENG RIGHT MAGNETO", SIMCONNECT_VARIABLE_TYPE_BOOL}, 173 | {"RECIP ENG BRAKE POWER", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 174 | {"RECIP ENG STARTER TORQUE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 175 | {"RECIP ENG TURBOCHARGER FAILED", SIMCONNECT_VARIABLE_TYPE_BOOL}, 176 | {"RECIP ENG EMERGENCY BOOST ACTIVE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 177 | {"RECIP ENG EMERGENCY BOOST ELAPSED TIME", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 178 | {"RECIP ENG WASTEGATE POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 179 | {"RECIP ENG TURBINE INLET TEMPERATURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 180 | {"RECIP ENG CYLINDER HEAD TEMPERATURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 181 | {"RECIP ENG RADIATOR TEMPERATURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 182 | {"RECIP ENG FUEL AVAILABLE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 183 | {"RECIP ENG FUEL FLOW", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 184 | {"RECIP ENG FUEL TANK SELECTOR", SIMCONNECT_VARIABLE_TYPE_INT32}, 185 | {"RECIP ENG FUEL NUMBER TANKS USED", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 186 | {"RECIP CARBURETOR TEMPERATURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 187 | {"RECIP MIXTURE RATIO", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 188 | {"TURB ENG N1", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 189 | {"TURB ENG N2", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 190 | {"TURB ENG CORRECTED N1", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 191 | {"TURB ENG CORRECTED N2", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 192 | {"TURB ENG CORRECTED FF", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 193 | {"TURB ENG MAX TORQUE PERCENT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 194 | {"TURB ENG PRESSURE RATIO", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 195 | {"TURB ENG ITT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 196 | {"TURB ENG AFTERBURNER", SIMCONNECT_VARIABLE_TYPE_BOOL}, 197 | {"TURB ENG JET THRUST", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 198 | {"TURB ENG BLEED AIR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 199 | {"TURB ENG TANK SELECTOR", SIMCONNECT_VARIABLE_TYPE_INT32}, 200 | {"TURB ENG NUM TANKS USED", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 201 | {"TURB ENG FUEL FLOW PPH", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 202 | {"TURB ENG FUEL AVAILABLE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 203 | {"TURB ENG REVERSE NOZZLE PERCENT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 204 | {"TURB ENG VIBRATION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 205 | {"TURB ENG COMMANDED N1", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 206 | {"TURB ENG THROTTLE COMMANDED N1", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 207 | {"ENG FAILED", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 208 | {"ENG RPM ANIMATION PERCENT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 209 | {"ENG ON FIRE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 210 | {"ENG FUEL FLOW BUG POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 211 | {"PROP RPM", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 212 | {"PROP MAX RPM PERCENT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 213 | {"PROP THRUST", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 214 | {"PROP BETA", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 215 | {"PROP FEATHERING INHIBIT", SIMCONNECT_VARIABLE_TYPE_BOOL}, 216 | {"PROP FEATHERED", SIMCONNECT_VARIABLE_TYPE_BOOL}, 217 | {"PROP SYNC DELTA LEVER", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 218 | {"PROP AUTO FEATHER ARMED", SIMCONNECT_VARIABLE_TYPE_BOOL}, 219 | {"PROP FEATHER SWITCH", SIMCONNECT_VARIABLE_TYPE_BOOL}, 220 | {"PANEL AUTO FEATHER SWITCH", SIMCONNECT_VARIABLE_TYPE_BOOL}, 221 | {"PROP SYNC ACTIVE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 222 | {"PROP DEICE SWITCH", SIMCONNECT_VARIABLE_TYPE_BOOL}, 223 | {"ENG COMBUSTION", SIMCONNECT_VARIABLE_TYPE_BOOL}, 224 | {"ENG N1 RPM", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 225 | {"ENG N2 RPM", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 226 | {"ENG FUEL FLOW PPH", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 227 | {"ENG TORQUE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 228 | {"ENG ANTI ICE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 229 | {"ENG EXHAUST GAS TEMPERATURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 230 | {"ENG EXHAUST GAS TEMPERATURE GES", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 231 | {"ENG CYLINDER HEAD TEMPERATURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 232 | {"ENG OIL TEMPERATURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 233 | {"ENG OIL PRESSURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 234 | {"ENG OIL QUANTITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 235 | {"ENG HYDRAULIC PRESSURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 236 | {"ENG HYDRAULIC QUANTITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 237 | {"ENG MANIFOLD PRESSURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 238 | {"ENG VIBRATION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 239 | {"ENG RPM SCALER", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 240 | {"ENG TURBINE TEMPERATURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 241 | {"ENG TORQUE PERCENT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 242 | {"ENG FUEL PRESSURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 243 | {"ENG ELECTRICAL LOAD", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 244 | {"ENG TRANSMISSION PRESSURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 245 | {"ENG TRANSMISSION TEMPERATURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 246 | {"ENG ROTOR RPM", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 247 | {"ENG MAX RPM", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 248 | {"GENERAL ENG STARTER ACTIVE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 249 | {"GENERAL ENG FUEL USED SINCE START", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 250 | {"TURB ENG N1", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 251 | {"TURB ENG N2", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 252 | {"TURB ENG CORRECTED N1", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 253 | {"TURB ENG CORRECTED N2", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 254 | {"TURB ENG PRIMARY NOZZLE PERCENT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 255 | {"TURB ENG IGNITION SWITCH", SIMCONNECT_VARIABLE_TYPE_BOOL}, 256 | {"TURB ENG MASTER STARTER SWITCH", SIMCONNECT_VARIABLE_TYPE_BOOL}, 257 | {"FUEL TANK CENTER LEVEL", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 258 | {"FUEL TANK CENTER2 LEVEL", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 259 | {"FUEL TANK CENTER3 LEVEL", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 260 | {"FUEL TANK LEFT MAIN LEVEL", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 261 | {"FUEL TANK LEFT AUX LEVEL", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 262 | {"FUEL TANK LEFT TIP LEVEL", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 263 | {"FUEL TANK RIGHT MAIN LEVEL", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 264 | {"FUEL TANK RIGHT AUX LEVEL", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 265 | {"FUEL TANK RIGHT TIP LEVEL", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 266 | {"FUEL TANK EXTERNAL1 LEVEL", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 267 | {"FUEL TANK EXTERNAL2 LEVEL", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 268 | {"FUEL TANK CENTER CAPACITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 269 | {"FUEL TANK CENTER2 CAPACITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 270 | {"FUEL TANK CENTER3 CAPACITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 271 | {"FUEL TANK LEFT MAIN CAPACITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 272 | {"FUEL TANK LEFT AUX CAPACITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 273 | {"FUEL TANK LEFT TIP CAPACITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 274 | {"FUEL TANK RIGHT MAIN CAPACITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 275 | {"FUEL TANK RIGHT AUX CAPACITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 276 | {"FUEL TANK RIGHT TIP CAPACITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 277 | {"FUEL TANK EXTERNAL1 CAPACITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 278 | {"FUEL TANK EXTERNAL2 CAPACITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 279 | {"FUEL LEFT CAPACITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 280 | {"FUEL RIGHT CAPACITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 281 | {"FUEL TANK CENTER QUANTITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 282 | {"FUEL TANK CENTER2 QUANTITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 283 | {"FUEL TANK CENTER3 QUANTITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 284 | {"FUEL TANK LEFT MAIN QUANTITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 285 | {"FUEL TANK LEFT AUX QUANTITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 286 | {"FUEL TANK LEFT TIP QUANTITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 287 | {"FUEL TANK RIGHT MAIN QUANTITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 288 | {"FUEL TANK RIGHT AUX QUANTITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 289 | {"FUEL TANK RIGHT TIP QUANTITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 290 | {"FUEL TANK EXTERNAL1 QUANTITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 291 | {"FUEL TANK EXTERNAL2 QUANTITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 292 | {"FUEL LEFT QUANTITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 293 | {"FUEL RIGHT QUANTITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 294 | {"FUEL TOTAL QUANTITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 295 | {"FUEL WEIGHT PER GALLON", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 296 | {"FUEL TANK SELECTOR", SIMCONNECT_VARIABLE_TYPE_INT32}, 297 | {"FUEL CROSS FEED", SIMCONNECT_VARIABLE_TYPE_INT32}, 298 | {"FUEL TOTAL CAPACITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 299 | {"FUEL SELECTED QUANTITY PERCENT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 300 | {"FUEL SELECTED QUANTITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 301 | {"FUEL TOTAL QUANTITY WEIGHT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 302 | {"NUM FUEL SELECTORS", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 303 | {"UNLIMITED FUEL", SIMCONNECT_VARIABLE_TYPE_BOOL}, 304 | {"ESTIMATED FUEL FLOW", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 305 | {"LIGHT STROBE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 306 | {"LIGHT PANEL", SIMCONNECT_VARIABLE_TYPE_BOOL}, 307 | {"LIGHT LANDING", SIMCONNECT_VARIABLE_TYPE_BOOL}, 308 | {"LIGHT TAXI", SIMCONNECT_VARIABLE_TYPE_BOOL}, 309 | {"LIGHT BEACON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 310 | {"LIGHT NAV", SIMCONNECT_VARIABLE_TYPE_BOOL}, 311 | {"LIGHT LOGO", SIMCONNECT_VARIABLE_TYPE_BOOL}, 312 | {"LIGHT WING", SIMCONNECT_VARIABLE_TYPE_BOOL}, 313 | {"LIGHT RECOGNITION", SIMCONNECT_VARIABLE_TYPE_BOOL}, 314 | {"LIGHT CABIN", SIMCONNECT_VARIABLE_TYPE_BOOL}, 315 | {"GROUND VELOCITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 316 | {"TOTAL WORLD VELOCITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 317 | {"VELOCITY BODY Z", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 318 | {"VELOCITY BODY X", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 319 | {"VELOCITY BODY Y", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 320 | {"VELOCITY WORLD Z", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 321 | {"VELOCITY WORLD X", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 322 | {"VELOCITY WORLD Y", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 323 | {"ACCELERATION WORLD X", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 324 | {"ACCELERATION WORLD Y", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 325 | {"ACCELERATION WORLD Z", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 326 | {"ACCELERATION BODY X", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 327 | {"ACCELERATION BODY Y", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 328 | {"ACCELERATION BODY Z", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 329 | {"ROTATION VELOCITY BODY X", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 330 | {"ROTATION VELOCITY BODY Y", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 331 | {"ROTATION VELOCITY BODY Z", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 332 | {"RELATIVE WIND VELOCITY BODY X", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 333 | {"RELATIVE WIND VELOCITY BODY Y", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 334 | {"RELATIVE WIND VELOCITY BODY Z", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 335 | {"PLANE ALT ABOVE GROUND", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 336 | {"PLANE ALT ABOVE GROUND MINUS CG", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 337 | {"PLANE LATITUDE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 338 | {"PLANE LONGITUDE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 339 | {"PLANE ALTITUDE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 340 | {"PLANE PITCH DEGREES", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 341 | {"PLANE BANK DEGREES", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 342 | {"PLANE HEADING DEGREES TRUE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 343 | {"PLANE HEADING DEGREES MAGNETIC", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 344 | {"MAGVAR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 345 | {"GROUND ALTITUDE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 346 | {"SURFACE TYPE", SIMCONNECT_VARIABLE_TYPE_INT32}, 347 | {"SIM ON GROUND", SIMCONNECT_VARIABLE_TYPE_BOOL}, 348 | {"INCIDENCE ALPHA", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 349 | {"INCIDENCE BETA", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 350 | {"AIRSPEED TRUE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 351 | {"AIRSPEED INDICATED", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 352 | {"AIRSPEED TRUE CALIBRATE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 353 | {"AIRSPEED BARBER POLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 354 | {"AIRSPEED MACH", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 355 | {"VERTICAL SPEED", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 356 | {"MACH MAX OPERATE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 357 | {"STALL WARNING", SIMCONNECT_VARIABLE_TYPE_BOOL}, 358 | {"OVERSPEED WARNING", SIMCONNECT_VARIABLE_TYPE_BOOL}, 359 | {"BARBER POLE MACH", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 360 | {"INDICATED ALTITUDE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 361 | {"KOHLSMAN SETTING MB", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 362 | {"KOHLSMAN SETTING HG", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 363 | {"ATTITUDE INDICATOR PITCH DEGREES", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 364 | {"ATTITUDE INDICATOR BANK DEGREES", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 365 | {"ATTITUDE BARS POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 366 | {"ATTITUDE CAGE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 367 | {"WISKEY COMPASS INDICATION DEGREES", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 368 | {"PLANE HEADING DEGREES GYRO", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 369 | {"HEADING INDICATOR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 370 | {"GYRO DRIFT ERROR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 371 | {"DELTA HEADING RATE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 372 | {"TURN COORDINATOR BALL", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 373 | {"ANGLE OF ATTACK INDICATOR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 374 | {"RADIO HEIGHT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 375 | {"PARTIAL PANEL ADF", SIMCONNECT_VARIABLE_TYPE_INT32}, 376 | {"PARTIAL PANEL AIRSPEED", SIMCONNECT_VARIABLE_TYPE_INT32}, 377 | {"PARTIAL PANEL ALTIMETER", SIMCONNECT_VARIABLE_TYPE_INT32}, 378 | {"PARTIAL PANEL ATTITUDE", SIMCONNECT_VARIABLE_TYPE_INT32}, 379 | {"PARTIAL PANEL COMM", SIMCONNECT_VARIABLE_TYPE_INT32}, 380 | {"PARTIAL PANEL COMPASS", SIMCONNECT_VARIABLE_TYPE_INT32}, 381 | {"PARTIAL PANEL ELECTRICAL", SIMCONNECT_VARIABLE_TYPE_INT32}, 382 | {"PARTIAL PANEL AVIONICS", SIMCONNECT_VARIABLE_TYPE_INT32}, 383 | {"PARTIAL PANEL ENGINE", SIMCONNECT_VARIABLE_TYPE_INT32}, 384 | {"PARTIAL PANEL FUEL INDICATOR", SIMCONNECT_VARIABLE_TYPE_INT32}, 385 | {"PARTIAL PANEL HEADING", SIMCONNECT_VARIABLE_TYPE_INT32}, 386 | {"PARTIAL PANEL VERTICAL VELOCITY", SIMCONNECT_VARIABLE_TYPE_INT32}, 387 | {"PARTIAL PANEL TRANSPONDER", SIMCONNECT_VARIABLE_TYPE_INT32}, 388 | {"PARTIAL PANEL NAV", SIMCONNECT_VARIABLE_TYPE_INT32}, 389 | {"PARTIAL PANEL PITOT", SIMCONNECT_VARIABLE_TYPE_INT32}, 390 | {"PARTIAL PANEL TURN COORDINATOR", SIMCONNECT_VARIABLE_TYPE_INT32}, 391 | {"PARTIAL PANEL VACUUM", SIMCONNECT_VARIABLE_TYPE_INT32}, 392 | {"MAX G FORCE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 393 | {"MIN G FORCE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 394 | {"SUCTION PRESSURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 395 | {"AVIONICS MASTER SWITCH", SIMCONNECT_VARIABLE_TYPE_BOOL}, 396 | {"NAV SOUND", SIMCONNECT_VARIABLE_TYPE_BOOL}, 397 | {"DME SOUND", SIMCONNECT_VARIABLE_TYPE_BOOL}, 398 | {"ADF SOUND", SIMCONNECT_VARIABLE_TYPE_BOOL}, 399 | {"MARKER SOUND", SIMCONNECT_VARIABLE_TYPE_BOOL}, 400 | {"COM TRANSMIT", SIMCONNECT_VARIABLE_TYPE_BOOL}, 401 | {"COM RECIEVE ALL", SIMCONNECT_VARIABLE_TYPE_BOOL}, 402 | {"COM STATUS", SIMCONNECT_VARIABLE_TYPE_INT32}, 403 | {"NAV AVAILABLE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 404 | {"NAV ACTIVE FREQUENCY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 405 | {"NAV STANDBY FREQUENCY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 406 | {"NAV SIGNAL", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 407 | {"NAV HAS NAV", SIMCONNECT_VARIABLE_TYPE_BOOL}, 408 | {"NAV HAS LOCALIZER", SIMCONNECT_VARIABLE_TYPE_BOOL}, 409 | {"NAV HAS DME", SIMCONNECT_VARIABLE_TYPE_BOOL}, 410 | {"NAV HAS GLIDE SLOPE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 411 | {"NAV BACK COURSE FLAGS", SIMCONNECT_VARIABLE_TYPE_BOOL}, 412 | {"NAV MAGVAR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 413 | {"NAV RADIAL", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 414 | {"NAV RADIAL ERROR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 415 | {"NAV LOCALIZER", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 416 | {"NAV GLIDE SLOPE ERROR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 417 | {"NAV CDI", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 418 | {"NAV GSI", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 419 | {"NAV TOFROM", SIMCONNECT_VARIABLE_TYPE_INT32}, 420 | {"NAV GS FLAG", SIMCONNECT_VARIABLE_TYPE_BOOL}, 421 | {"NAV OBS", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 422 | {"NAV DME", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 423 | {"NAV DMESPEED", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 424 | {"ADF STANDBY FREQUENCY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 425 | {"ADF RADIAL", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 426 | {"ADF SIGNAL", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 427 | {"MARKER BEACON STATE", SIMCONNECT_VARIABLE_TYPE_INT32}, 428 | {"INNER MARKER", SIMCONNECT_VARIABLE_TYPE_BOOL}, 429 | {"MIDDLE MARKER", SIMCONNECT_VARIABLE_TYPE_BOOL}, 430 | {"OUTER MARKER", SIMCONNECT_VARIABLE_TYPE_BOOL}, 431 | {"NAV RAW GLIDE SLOPE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 432 | {"ADF CARD", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 433 | {"HSI CDI NEEDLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 434 | {"HSI GSI NEEDLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 435 | {"HSI CDI NEEDLE VALID", SIMCONNECT_VARIABLE_TYPE_BOOL}, 436 | {"HSI GSI NEEDLE VALID", SIMCONNECT_VARIABLE_TYPE_BOOL}, 437 | {"HSI TF FLAGS", SIMCONNECT_VARIABLE_TYPE_INT32}, 438 | {"HSI BEARING VALID", SIMCONNECT_VARIABLE_TYPE_BOOL}, 439 | {"HSI BEARING", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 440 | {"HSI HAS LOCALIZER", SIMCONNECT_VARIABLE_TYPE_BOOL}, 441 | {"HSI SPEED", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 442 | {"HSI DISTANCE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 443 | {"GPS POSITION LAT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 444 | {"GPS POSITION LON", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 445 | {"GPS POSITION ALT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 446 | {"GPS MAGVAR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 447 | {"GPS IS ACTIVE FLIGHT PLAN", SIMCONNECT_VARIABLE_TYPE_BOOL}, 448 | {"GPS IS ACTIVE WAY POINT", SIMCONNECT_VARIABLE_TYPE_BOOL}, 449 | {"GPS IS ARRIVED", SIMCONNECT_VARIABLE_TYPE_BOOL}, 450 | {"GPS IS DIRECTTO FLIGHTPLAN", SIMCONNECT_VARIABLE_TYPE_BOOL}, 451 | {"GPS GROUND SPEED", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 452 | {"GPS GROUND TRUE HEADING", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 453 | {"GPS GROUND MAGNETIC TRACK", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 454 | {"GPS GROUND TRUE TRACK", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 455 | {"GPS WP DISTANCE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 456 | {"GPS WP BEARING", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 457 | {"GPS WP TRUE BEARING", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 458 | {"GPS WP CROSS TRK", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 459 | {"GPS WP DESIRED TRACK", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 460 | {"GPS WP TRUE REQ HDG", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 461 | {"GPS WP VERTICAL SPEED", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 462 | {"GPS WP TRACK ANGLE ERROR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 463 | {"GPS ETE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 464 | {"GPS ETA", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 465 | {"GPS WP NEXT LAT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 466 | {"GPS WP NEXT LON", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 467 | {"GPS WP NEXT ALT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 468 | {"GPS WP PREV VALID", SIMCONNECT_VARIABLE_TYPE_BOOL}, 469 | {"GPS WP PREV LAT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 470 | {"GPS WP PREV LON", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 471 | {"GPS WP PREV ALT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 472 | {"GPS WP ETE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 473 | {"GPS WP ETA", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 474 | {"GPS COURSE TO STEER", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 475 | {"GPS FLIGHT PLAN WP INDEX", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 476 | {"GPS FLIGHT PLAN WP COUNT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 477 | {"GPS IS ACTIVE WP LOCKED", SIMCONNECT_VARIABLE_TYPE_BOOL}, 478 | {"GPS IS APPROACH LOADED", SIMCONNECT_VARIABLE_TYPE_BOOL}, 479 | {"GPS IS APPROACH ACTIVE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 480 | {"GPS APPROACH MODE", SIMCONNECT_VARIABLE_TYPE_INT32}, 481 | {"GPS APPROACH WP TYPE", SIMCONNECT_VARIABLE_TYPE_INT32}, 482 | {"GPS APPROACH IS WP RUNWAY", SIMCONNECT_VARIABLE_TYPE_BOOL}, 483 | {"GPS APPROACH SEGMENT TYPE", SIMCONNECT_VARIABLE_TYPE_INT32}, 484 | {"GPS APPROACH APPROACH INDEX", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 485 | {"GPS APPROACH APPROACH TYPE", SIMCONNECT_VARIABLE_TYPE_INT32}, 486 | {"GPS APPROACH TRANSITION INDEX", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 487 | {"GPS APPROACH IS FINAL", SIMCONNECT_VARIABLE_TYPE_BOOL}, 488 | {"GPS APPROACH IS MISSED", SIMCONNECT_VARIABLE_TYPE_BOOL}, 489 | {"GPS APPROACH TIMEZONE DEVIATION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 490 | {"GPS APPROACH WP INDEX", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 491 | {"GPS APPROACH WP COUNT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 492 | {"GPS VERTICAL ERROR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 493 | {"GPS DRIVES NAV1", SIMCONNECT_VARIABLE_TYPE_BOOL}, 494 | {"COM RECEIVE ALL", SIMCONNECT_VARIABLE_TYPE_BOOL}, 495 | {"COM AVAILABLE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 496 | {"COM TEST", SIMCONNECT_VARIABLE_TYPE_BOOL}, 497 | {"TRANSPONDER AVAILABLE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 498 | {"ADF AVAILABLE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 499 | {"NAV GLIDE SLOPE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 500 | {"NAV RELATIVE BEARING TO STATION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 501 | {"SELECTED DME", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 502 | {"GPS TARGET DISTANCE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 503 | {"GPS TARGET ALTITUDE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 504 | {"YOKE Y POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 505 | {"YOKE X POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 506 | {"RUDDER PEDAL POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 507 | {"RUDDER POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 508 | {"ELEVATOR POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 509 | {"AILERON POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 510 | {"ELEVATOR TRIM POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 511 | {"ELEVATOR TRIM INDICATOR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 512 | {"ELEVATOR TRIM PCT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 513 | {"BRAKE LEFT POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 514 | {"BRAKE RIGHT POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 515 | {"BRAKE INDICATOR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 516 | {"BRAKE PARKING POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 517 | {"BRAKE PARKING INDICATOR", SIMCONNECT_VARIABLE_TYPE_BOOL}, 518 | {"SPOILERS ARMED", SIMCONNECT_VARIABLE_TYPE_BOOL}, 519 | {"SPOILERS HANDLE POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 520 | {"SPOILERS LEFT POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 521 | {"SPOILERS RIGHT POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 522 | {"FLAPS HANDLE PERCENT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 523 | {"FLAPS HANDLE INDEX", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 524 | {"FLAPS NUM HANDLE POSITIONS", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 525 | {"TRAILING EDGE FLAPS LEFT PERCENT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 526 | {"TRAILING EDGE FLAPS RIGHT PERCENT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 527 | {"TRAILING EDGE FLAPS LEFT ANGLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 528 | {"TRAILING EDGE FLAPS RIGHT ANGLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 529 | {"LEADING EDGE FLAPS LEFT PERCENT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 530 | {"LEADING EDGE FLAPS RIGHT PERCENT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 531 | {"LEADING EDGE FLAPS LEFT ANGLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 532 | {"LEADING EDGE FLAPS RIGHT ANGLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 533 | {"IS GEAR RETRACTABLE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 534 | {"IS GEAR SKIS", SIMCONNECT_VARIABLE_TYPE_BOOL}, 535 | {"IS GEAR FLOATS", SIMCONNECT_VARIABLE_TYPE_BOOL}, 536 | {"IS GEAR SKIDS", SIMCONNECT_VARIABLE_TYPE_BOOL}, 537 | {"IS GEAR WHEELS", SIMCONNECT_VARIABLE_TYPE_BOOL}, 538 | {"GEAR HANDLE POSITION", SIMCONNECT_VARIABLE_TYPE_BOOL}, 539 | {"GEAR HYDRAULIC PRESSURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 540 | {"TAILWHEEL LOCK ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 541 | {"GEAR CENTER POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 542 | {"GEAR LEFT POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 543 | {"GEAR RIGHT POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 544 | {"GEAR TAIL POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 545 | {"GEAR AUX POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 546 | {"GEAR POSITION", SIMCONNECT_VARIABLE_TYPE_INT32}, 547 | {"GEAR ANIMATION POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 548 | {"GEAR TOTAL PCT EXTENDED", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 549 | {"AUTO BRAKE SWITCH CB", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 550 | {"WATER RUDDER HANDLE POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 551 | {"ELEVATOR DEFLECTION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 552 | {"ELEVATOR DEFLECTION PCT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 553 | {"WATER LEFT RUDDER EXTENDED", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 554 | {"WATER RIGHT RUDDER EXTENDED", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 555 | {"GEAR CENTER STEER ANGLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 556 | {"GEAR LEFT STEER ANGLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 557 | {"GEAR RIGHT STEER ANGLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 558 | {"GEAR AUX STEER ANGLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 559 | {"GEAR STEER ANGLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 560 | {"WATER LEFT RUDDER STEER ANGLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 561 | {"WATER RIGHT RUDDER STEER ANGLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 562 | {"GEAR CENTER STEER ANGLE PCT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 563 | {"GEAR LEFT STEER ANGLE PCT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 564 | {"GEAR RIGHT STEER ANGLE PCT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 565 | {"GEAR AUX STEER ANGLE PCT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 566 | {"GEAR STEER ANGLE PCT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 567 | {"WATER LEFT RUDDER STEER ANGLE PCT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 568 | {"WATER RIGHT RUDDER STEER ANGLE PCT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 569 | {"AILERON LEFT DEFLECTION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 570 | {"AILERON LEFT DEFLECTION PCT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 571 | {"AILERON RIGHT DEFLECTION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 572 | {"AILERON RIGHT DEFLECTION PCT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 573 | {"AILERON AVERAGE DEFLECTION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 574 | {"AILERON TRIM", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 575 | {"AILERON TRIM PCT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 576 | {"RUDDER DEFLECTION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 577 | {"RUDDER DEFLECTION PCT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 578 | {"RUDDER TRIM", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 579 | {"RUDDER TRIM PCT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 580 | {"FLAPS AVAILABLE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 581 | {"GEAR DAMAGE BY SPEED", SIMCONNECT_VARIABLE_TYPE_BOOL}, 582 | {"GEAR SPEED EXCEEDED", SIMCONNECT_VARIABLE_TYPE_BOOL}, 583 | {"FLAP DAMAGE BY SPEED", SIMCONNECT_VARIABLE_TYPE_BOOL}, 584 | {"FLAP SPEED EXCEEDED", SIMCONNECT_VARIABLE_TYPE_BOOL}, 585 | {"CENTER WHEEL RPM", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 586 | {"LEFT WHEEL RPM", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 587 | {"RIGHT WHEEL RPM", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 588 | {"AUTOPILOT AVAILABLE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 589 | {"AUTOPILOT MASTER", SIMCONNECT_VARIABLE_TYPE_BOOL}, 590 | {"AUTOPILOT NAV SELECTED", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 591 | {"AUTOPILOT WING LEVELER", SIMCONNECT_VARIABLE_TYPE_BOOL}, 592 | {"AUTOPILOT NAV1 LOCK", SIMCONNECT_VARIABLE_TYPE_BOOL}, 593 | {"AUTOPILOT HEADING LOCK", SIMCONNECT_VARIABLE_TYPE_BOOL}, 594 | {"AUTOPILOT HEADING LOCK DIR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 595 | {"AUTOPILOT ALTITUDE LOCK", SIMCONNECT_VARIABLE_TYPE_BOOL}, 596 | {"AUTOPILOT ALTITUDE LOCK VAR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 597 | {"AUTOPILOT ATTITUDE HOLD", SIMCONNECT_VARIABLE_TYPE_BOOL}, 598 | {"AUTOPILOT GLIDESLOPE HOLD", SIMCONNECT_VARIABLE_TYPE_BOOL}, 599 | {"AUTOPILOT PITCH HOLD REF", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 600 | {"AUTOPILOT APPROACH HOLD", SIMCONNECT_VARIABLE_TYPE_BOOL}, 601 | {"AUTOPILOT BACKCOURSE HOLD", SIMCONNECT_VARIABLE_TYPE_BOOL}, 602 | {"AUTOPILOT VERTICAL HOLD VAR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 603 | {"AUTOPILOT FLIGHT DIRECTOR ACTIVE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 604 | {"AUTOPILOT FLIGHT DIRECTOR PITCH", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 605 | {"AUTOPILOT FLIGHT DIRECTOR BANK", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 606 | {"AUTOPILOT AIRSPEED HOLD", SIMCONNECT_VARIABLE_TYPE_BOOL}, 607 | {"AUTOPILOT AIRSPEED HOLD VAR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 608 | {"AUTOPILOT MACH HOLD", SIMCONNECT_VARIABLE_TYPE_BOOL}, 609 | {"AUTOPILOT MACH HOLD VAR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 610 | {"AUTOPILOT YAW DAMPER", SIMCONNECT_VARIABLE_TYPE_BOOL}, 611 | {"AUTOPILOT RPM HOLD VAR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 612 | {"AUTOPILOT THROTTLE ARM", SIMCONNECT_VARIABLE_TYPE_BOOL}, 613 | {"AUTOPILOT TAKEOFF POWER ACTIVE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 614 | {"AUTOTHROTTLE ACTIVE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 615 | {"AUTOPILOT NAV1 LOCK", SIMCONNECT_VARIABLE_TYPE_BOOL}, 616 | {"AUTOPILOT VERTICAL HOLD", SIMCONNECT_VARIABLE_TYPE_BOOL}, 617 | {"AUTOPILOT RPM HOLD", SIMCONNECT_VARIABLE_TYPE_BOOL}, 618 | {"AUTOPILOT MAX BANK", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 619 | {"WHEEL RPM", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 620 | {"AUX WHEEL RPM", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 621 | {"WHEEL ROTATION ANGLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 622 | {"CENTER WHEEL ROTATION ANGLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 623 | {"LEFT WHEEL ROTATION ANGLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 624 | {"RIGHT WHEEL ROTATION ANGLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 625 | {"AUX WHEEL ROTATION ANGLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 626 | {"GEAR EMERGENCY HANDLE POSITION", SIMCONNECT_VARIABLE_TYPE_BOOL}, 627 | {"GEAR WARNING", SIMCONNECT_VARIABLE_TYPE_INT32}, 628 | {"ANTISKID BRAKES ACTIVE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 629 | {"RETRACT FLOAT SWITCH", SIMCONNECT_VARIABLE_TYPE_BOOL}, 630 | {"RETRACT LEFT FLOAT EXTENDED", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 631 | {"RETRACT RIGHT FLOAT EXTENDED", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 632 | {"STEER INPUT CONTROL", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 633 | {"AMBIENT DENSITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 634 | {"AMBIENT TEMPERATURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 635 | {"AMBIENT PRESSURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 636 | {"AMBIENT WIND VELOCITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 637 | {"AMBIENT WIND DIRECTION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 638 | {"AMBIENT WIND X", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 639 | {"AMBIENT WIND Y", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 640 | {"AMBIENT WIND Z", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 641 | {"AIRCRAFT WIND X", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 642 | {"AIRCRAFT WIND Y", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 643 | {"AIRCRAFT WIND Z", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 644 | {"BAROMETER PRESSURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 645 | {"SEA LEVEL PRESSURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 646 | {"TOTAL AIR TEMPERATURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 647 | {"WINDSHIELD RAIN EFFECT AVAILABLE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 648 | {"AMBIENT IN CLOUD", SIMCONNECT_VARIABLE_TYPE_BOOL}, 649 | {"AMBIENT VISIBILITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 650 | {"STANDARD ATM TEMPERATURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 651 | {"ROTOR BRAKE HANDLE POS", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 652 | {"ROTOR BRAKE ACTIVE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 653 | {"ROTOR CLUTCH SWITCH POS", SIMCONNECT_VARIABLE_TYPE_BOOL}, 654 | {"ROTOR CLUTCH ACTIVE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 655 | {"ROTOR TEMPERATURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 656 | {"ROTOR CHIP DETECTED", SIMCONNECT_VARIABLE_TYPE_BOOL}, 657 | {"ROTOR GOV SWITCH POS", SIMCONNECT_VARIABLE_TYPE_BOOL}, 658 | {"ROTOR GOV ACTIVE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 659 | {"ROTOR LATERAL TRIM PCT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 660 | {"ROTOR RPM PCT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 661 | {"SMOKE ENABLE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 662 | {"SMOKESYSTEM AVAILABLE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 663 | {"PITOT HEAT", SIMCONNECT_VARIABLE_TYPE_BOOL}, 664 | {"FOLDING WING LEFT PERCENT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 665 | {"FOLDING WING RIGHT PERCENT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 666 | {"CANOPY OPEN", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 667 | {"TAILHOOK POSITION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 668 | {"EXIT OPEN", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 669 | {"STALL HORN AVAILABLE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 670 | {"ENGINE MIXURE AVAILABLE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 671 | {"CARB HEAT AVAILABLE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 672 | {"SPOILER AVAILABLE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 673 | {"IS TAIL DRAGGER", SIMCONNECT_VARIABLE_TYPE_BOOL}, 674 | {"STROBES AVAILABLE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 675 | {"TOE BRAKES AVAILABLE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 676 | {"PUSHBACK STATE", SIMCONNECT_VARIABLE_TYPE_INT32}, 677 | {"ELECTRICAL MASTER BATTERY", SIMCONNECT_VARIABLE_TYPE_BOOL}, 678 | {"ELECTRICAL TOTAL LOAD AMPS", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 679 | {"ELECTRICAL BATTERY LOAD", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 680 | {"ELECTRICAL BATTERY VOLTAGE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 681 | {"ELECTRICAL MAIN BUS VOLTAGE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 682 | {"ELECTRICAL MAIN BUS AMPS", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 683 | {"ELECTRICAL AVIONICS BUS VOLTAGE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 684 | {"ELECTRICAL AVIONICS BUS AMPS", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 685 | {"ELECTRICAL HOT BATTERY BUS VOLTAGE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 686 | {"ELECTRICAL HOT BATTERY BUS AMPS", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 687 | {"ELECTRICAL BATTERY BUS VOLTAGE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 688 | {"ELECTRICAL BATTERY BUS AMPS", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 689 | {"ELECTRICAL GENALT BUS VOLTAGE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 690 | {"ELECTRICAL GENALT BUS AMPS", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 691 | {"CIRCUIT GENERAL PANEL ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 692 | {"CIRCUIT FLAP MOTOR ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 693 | {"CIRCUIT GEAR MOTOR ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 694 | {"CIRCUIT AUTOPILOT ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 695 | {"CIRCUIT AVIONICS ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 696 | {"CIRCUIT PITOT HEAT ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 697 | {"CIRCUIT PROP SYNC ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 698 | {"CIRCUIT AUTO FEATHER ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 699 | {"CIRCUIT AUTO BRAKES ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 700 | {"CIRCUIT STANDY VACUUM ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 701 | {"CIRCUIT MARKER BEACON ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 702 | {"CIRCUIT GEAR WARNING ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 703 | {"CIRCUIT HYDRAULIC PUMP ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 704 | {"HYDRAULIC PRESSURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 705 | {"HYDRAULIC RESERVOIR PERCENT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 706 | {"HYDRAULIC SYSTEM INTEGRITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 707 | {"STRUCTURAL DEICE SWITCH", SIMCONNECT_VARIABLE_TYPE_BOOL}, 708 | {"TOTAL WEIGHT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 709 | {"MAX GROSS WEIGHT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 710 | {"EMPTY WEIGHT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 711 | {"IS USER SIM", SIMCONNECT_VARIABLE_TYPE_BOOL}, 712 | {"SIM DISABLED", SIMCONNECT_VARIABLE_TYPE_BOOL}, 713 | {"G FORCE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 714 | {"ATC HEAVY", SIMCONNECT_VARIABLE_TYPE_BOOL}, 715 | {"AUTO COORDINATION", SIMCONNECT_VARIABLE_TYPE_BOOL}, 716 | {"REALISM", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 717 | {"TRUE AIRSPEED SELECTED", SIMCONNECT_VARIABLE_TYPE_BOOL}, 718 | {"DESIGN SPEED VS0", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 719 | {"DESIGN SPEED VS1", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 720 | {"DESIGN SPEED VC", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 721 | {"MIN DRAG VELOCITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 722 | {"ESTIMATED CRUISE SPEED", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 723 | {"CG PERCENT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 724 | {"CG PERCENT LATERAL", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 725 | {"IS SLEW ACTIVE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 726 | {"IS SLEW ALLOWED", SIMCONNECT_VARIABLE_TYPE_BOOL}, 727 | {"ATC SUGGESTED MIN RWY TAKEOFF", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 728 | {"ATC SUGGESTED MIN RWY LANDING", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 729 | {"PAYLOAD STATION WEIGHT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 730 | {"PAYLOAD STATION COUNT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 731 | {"USER INPUT ENABLED", SIMCONNECT_VARIABLE_TYPE_BOOL}, 732 | {"TYPICAL DESCENT RATE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 733 | {"VISUAL MODEL RADIUS", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 734 | {"SIGMA SQRT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 735 | {"DYNAMIC PRESSURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 736 | {"TOTAL VELOCITY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 737 | {"AIRSPEED SELECT INDICATED OR TRUE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 738 | {"VARIOMETER RATE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 739 | {"VARIOMETER SWITCH", SIMCONNECT_VARIABLE_TYPE_BOOL}, 740 | {"DESIGN SPEED VS0", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 741 | {"DESIGN SPEED VS1", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 742 | {"PRESSURE ALTITUDE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 743 | {"MAGNETIC COMPASS", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 744 | {"TURN INDICATOR RATE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 745 | {"TURN INDICATOR SWITCH", SIMCONNECT_VARIABLE_TYPE_BOOL}, 746 | {"YOKE Y INDICATOR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 747 | {"YOKE X INDICATOR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 748 | {"RUDDER PEDAL INDICATOR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 749 | {"BRAKE DEPENDENT HYDRAULIC PRESSURE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 750 | {"PANEL ANTI ICE SWITCH", SIMCONNECT_VARIABLE_TYPE_BOOL}, 751 | {"WING AREA", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 752 | {"WING SPAN", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 753 | {"BETA DOT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 754 | {"LINEAR CL ALPHA", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 755 | {"STALL ALPHA", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 756 | {"ZERO LIFT ALPHA", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 757 | {"CG AFT LIMIT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 758 | {"CG FWD LIMIT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 759 | {"CG MAX MACH", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 760 | {"CG MIN MACH", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 761 | {"ELEVON DEFLECTION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 762 | {"EXIT TYPE", SIMCONNECT_VARIABLE_TYPE_INT32}, 763 | {"EXIT POSX", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 764 | {"EXIT POSY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 765 | {"EXIT POSZ", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 766 | {"DECISION HEIGHT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 767 | {"DECISION ALTITUDE MSL", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 768 | {"EMPTY WEIGHT PITCH MOI", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 769 | {"EMPTY WEIGHT ROLL MOI", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 770 | {"EMPTY WEIGHT YAW MOI", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 771 | {"EMPTY WEIGHT CROSS COUPLED MOI", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 772 | {"TOTAL WEIGHT PITCH MOI", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 773 | {"TOTAL WEIGHT ROLL MOI", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 774 | {"TOTAL WEIGHT YAW MOI", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 775 | {"TOTAL WEIGHT CROSS COUPLED MOI", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 776 | {"WATER BALLAST VALVE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 777 | {"MAX RATED ENGINE RPM", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 778 | {"FULL THROTTLE THRUST TO WEIGHT RATIO", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 779 | {"PROP AUTO CRUISE ACTIVE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 780 | {"PROP ROTATION ANGLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 781 | {"PROP BETA MAX", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 782 | {"PROP BETA MIN", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 783 | {"PROP BETA MIN REVERSE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 784 | {"FUEL SELECTED TRANSFER MODE", SIMCONNECT_VARIABLE_TYPE_INT32}, 785 | {"MANUAL FUEL PUMP HANDLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 786 | {"BLEED AIR SOURCE CONTROL", SIMCONNECT_VARIABLE_TYPE_INT32}, 787 | {"ELECTRICAL OLD CHARGING AMPS", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 788 | {"HYDRAULIC SWITCH", SIMCONNECT_VARIABLE_TYPE_BOOL}, 789 | {"CONCORDE VISOR NOSE HANDLE", SIMCONNECT_VARIABLE_TYPE_INT32}, 790 | {"CONCORDE VISOR POSITION PERCENT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 791 | {"CONCORDE NOSE ANGLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 792 | {"REALISM CRASH WITH OTHERS", SIMCONNECT_VARIABLE_TYPE_BOOL}, 793 | {"REALISM CRASH DETECTION", SIMCONNECT_VARIABLE_TYPE_BOOL}, 794 | {"MANUAL INSTRUMENT LIGHTS", SIMCONNECT_VARIABLE_TYPE_BOOL}, 795 | {"PITOT ICE PCT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 796 | {"SEMIBODY LOADFACTOR Y", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 797 | {"SEMIBODY LOADFACTOR YDOT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 798 | {"RAD INS SWITCH", SIMCONNECT_VARIABLE_TYPE_BOOL}, 799 | {"SIMULATED RADIUS", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 800 | {"STRUCTURAL ICE PCT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 801 | {"ARTIFICIAL GROUND ELEVATION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 802 | {"SURFACE INFO VALID", SIMCONNECT_VARIABLE_TYPE_BOOL}, 803 | {"SURFACE CONDITION", SIMCONNECT_VARIABLE_TYPE_INT32}, 804 | {"PUSHBACK ANGLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 805 | {"PUSHBACK CONTACTX", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 806 | {"PUSHBACK CONTACTY", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 807 | {"PUSHBACK CONTACTZ", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 808 | {"PUSHBACK WAIT", SIMCONNECT_VARIABLE_TYPE_BOOL}, 809 | {"YAW STRING ANGLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 810 | {"YAW STRING PCT EXTENDED", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 811 | {"INDUCTOR COMPASS PERCENT DEVIATION", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 812 | {"INDUCTOR COMPASS HEADING REF", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 813 | {"ANEMOMETER PCT RPM", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 814 | {"ROTOR ROTATION ANGLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 815 | {"DISK PITCH ANGLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 816 | {"DISK BANK ANGLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 817 | {"DISK PITCH PCT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 818 | {"DISK BANK PCT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 819 | {"DISK CONING PCT", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 820 | {"NAV VOR LLAF64", SIMCONNECT_VARIABLE_TYPE_LATLONALT}, 821 | {"NAV GS LLAF64", SIMCONNECT_VARIABLE_TYPE_LATLONALT}, 822 | {"STATIC CG TO GROUND", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 823 | {"STATIC PITCH", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 824 | {"CRASH SEQUENCE", SIMCONNECT_VARIABLE_TYPE_INT32}, 825 | {"CRASH FLAG", SIMCONNECT_VARIABLE_TYPE_INT32}, 826 | {"TOW RELEASE HANDLE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 827 | {"TOW CONNECTION", SIMCONNECT_VARIABLE_TYPE_BOOL}, 828 | {"APU PCT RPM", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 829 | {"APU PCT STARTER", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 830 | {"APU VOLTS", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 831 | {"APU GENERATOR SWITCH", SIMCONNECT_VARIABLE_TYPE_BOOL}, 832 | {"APU GENERATOR ACTIVE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 833 | {"APU ON FIRE DETECTED", SIMCONNECT_VARIABLE_TYPE_BOOL}, 834 | {"PRESSURIZATION CABIN ALTITUDE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 835 | {"PRESSURIZATION CABIN ALTITUDE GOAL", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 836 | {"PRESSURIZATION CABIN ALTITUDE RATE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 837 | {"PRESSURIZATION PRESSURE DIFFERENTIAL", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 838 | {"PRESSURIZATION DUMP SWITCH", SIMCONNECT_VARIABLE_TYPE_BOOL}, 839 | {"FIRE BOTTLE SWITCH", SIMCONNECT_VARIABLE_TYPE_BOOL}, 840 | {"FIRE BOTTLE DISCHARGED", SIMCONNECT_VARIABLE_TYPE_BOOL}, 841 | {"CABIN NO SMOKING ALERT SWITCH", SIMCONNECT_VARIABLE_TYPE_BOOL}, 842 | {"CABIN SEATBELTS ALERT SWITCH", SIMCONNECT_VARIABLE_TYPE_BOOL}, 843 | {"GPWS WARNING", SIMCONNECT_VARIABLE_TYPE_BOOL}, 844 | {"GPWS SYSTEM ACTIVE", SIMCONNECT_VARIABLE_TYPE_BOOL}, 845 | {"IS LATITUDE LONGITUDE FREEZE ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 846 | {"IS ALTITUDE FREEZE ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 847 | {"IS ATTITUDE FREEZE ON", SIMCONNECT_VARIABLE_TYPE_BOOL}, 848 | {"ABSOLUTE TIME", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 849 | {"ZULU TIME", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 850 | {"ZULU DAY OF WEEK", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 851 | {"ZULU DAY OF MONTH", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 852 | {"ZULU MONTH OF YEAR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 853 | {"ZULU DAY OF YEAR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 854 | {"ZULU YEAR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 855 | {"LOCAL TIME", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 856 | {"LOCAL DAY OF WEEK", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 857 | {"LOCAL DAY OF MONTH", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 858 | {"LOCAL MONTH OF YEAR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 859 | {"LOCAL DAY OF YEAR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 860 | {"LOCAL YEAR", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 861 | {"TIME ZONE OFFSET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 862 | {"TIME OF DAY", SIMCONNECT_VARIABLE_TYPE_INT32}, 863 | {"SIMULATION RATE", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 864 | {"SIMULATION TIME", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 865 | {"UNITS OF MEASURE", SIMCONNECT_VARIABLE_TYPE_INT32}, 866 | // events 867 | {"AXIS_ELEVATOR_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 868 | {"AXIS_AILERONS_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 869 | {"AXIS_RUDDER_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 870 | {"AXIS_ELEV_TRIM_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 871 | {"AXIS_SPOILER_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 872 | {"AXIS_FLAPS_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 873 | {"AXIS_LEFT_BRAKE_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 874 | {"AXIS_RIGHT_BRAKE_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 875 | {"THROTTLE_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 876 | {"THROTTLE1_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 877 | {"THROTTLE2_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 878 | {"THROTTLE3_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 879 | {"THROTTLE4_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 880 | {"THROTTLE_AXIS_SET_EX1", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 881 | {"THROTTLE1_AXIS_SET_EX1", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 882 | {"THROTTLE2_AXIS_SET_EX1", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 883 | {"THROTTLE3_AXIS_SET_EX1", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 884 | {"THROTTLE4_AXIS_SET_EX1", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 885 | {"AXIS_THROTTLE_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 886 | {"AXIS_THROTTLE1_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 887 | {"AXIS_THROTTLE2_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 888 | {"AXIS_THROTTLE3_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 889 | {"AXIS_THROTTLE4_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 890 | {"MIXTURE_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 891 | {"MIXTURE1_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 892 | {"MIXTURE2_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 893 | {"MIXTURE3_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 894 | {"MIXTURE4_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 895 | {"MIXTURE_AXIS_SET_EX1", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 896 | {"MIXTURE1_AXIS_SET_EX1", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 897 | {"MIXTURE2_AXIS_SET_EX1", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 898 | {"MIXTURE3_AXIS_SET_EX1", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 899 | {"MIXTURE4_AXIS_SET_EX1", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 900 | {"AXIS_MIXTURE_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 901 | {"AXIS_MIXTURE1_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 902 | {"AXIS_MIXTURE2_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 903 | {"AXIS_MIXTURE3_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 904 | {"AXIS_MIXTURE4_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 905 | {"PROPELLER_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 906 | {"PROPELLER1_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 907 | {"PROPELLER2_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 908 | {"PROPELLER3_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 909 | {"PROPELLER4_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 910 | {"PROPELLER_AXIS_SET_EX1", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 911 | {"PROPELLER1_AXIS_SET_EX1", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 912 | {"PROPELLER2_AXIS_SET_EX1", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 913 | {"PROPELLER3_AXIS_SET_EX1", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 914 | {"PROPELLER4_AXIS_SET_EX1", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 915 | {"AXIS_PROPELLER_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 916 | {"AXIS_PROPELLER1_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 917 | {"AXIS_PROPELLER2_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 918 | {"AXIS_PROPELLER3_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 919 | {"AXIS_PROPELLER4_SET", SIMCONNECT_VARIABLE_TYPE_FLOAT64}, 920 | }; 921 | }; 922 | -------------------------------------------------------------------------------- /sim-connect-interface/include/SimConnectVariableParser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Andreas Guther 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | #include "SimConnectVariable.h" 23 | #include "SimConnectDataDefinition.h" 24 | 25 | namespace simconnect::toolbox::connection { 26 | class SimConnectVariableParser; 27 | } 28 | 29 | class simconnect::toolbox::connection::SimConnectVariableParser { 30 | public: 31 | SimConnectVariableParser( 32 | SimConnectVariableParser const & 33 | ) = delete; 34 | 35 | void operator=( 36 | SimConnectVariableParser const & 37 | ) = delete; 38 | 39 | static std::vector getSimConnectVariablesFromParameterString( 40 | const std::string ¶meter 41 | ) { 42 | // variable to hold result 43 | std::vector simConnectVariables; 44 | 45 | // get lines from parameter 46 | std::vector lines = getVariableLines(parameter); 47 | 48 | simConnectVariables.reserve(lines.size()); 49 | for (const auto &line : lines) { 50 | simConnectVariables.emplace_back(getSimConnectVariableFromVariableLine(line)); 51 | } 52 | 53 | // need to parse string 54 | return simConnectVariables; 55 | } 56 | 57 | static SimConnectDataDefinition getSimConnectDataDefinitionFromVariables( 58 | const std::vector &variables 59 | ) { 60 | // create data definition 61 | auto dataDefinition = SimConnectDataDefinition(); 62 | 63 | // add variables 64 | for (const auto &variable : variables) { 65 | dataDefinition.add(variable); 66 | } 67 | 68 | // return data definition 69 | return dataDefinition; 70 | } 71 | 72 | static std::vector getVariableLines( 73 | const std::string ¶meter 74 | ) { 75 | // result 76 | std::vector lines; 77 | 78 | // iterate over string and add lines to result 79 | size_t kPosition = 0; 80 | std::string kString = parameter; 81 | while ((kPosition = kString.find(VARIABLE_DELIMITER)) != std::string::npos) { 82 | lines.push_back(kString.substr(0, kPosition)); 83 | kString.erase(0, kPosition + VARIABLE_DELIMITER.length()); 84 | } 85 | 86 | // return result 87 | return lines; 88 | } 89 | 90 | static SimConnectVariable getSimConnectVariableFromVariableLine( 91 | const std::string &line 92 | ) { 93 | // find delimiter 94 | size_t kPosition = 0; 95 | if ((kPosition = line.find(VARIABLE_PARAMETER_DELIMITER)) != std::string::npos) { 96 | // get name and unit 97 | std::string name = line.substr(0, kPosition); 98 | std::string unit = line.substr(kPosition + 1, std::string::npos); 99 | 100 | // trim them 101 | trim(name); 102 | trim(unit); 103 | 104 | // return result 105 | return SimConnectVariable(name, unit); 106 | } 107 | throw std::invalid_argument("Variable not valid!"); 108 | } 109 | 110 | private: 111 | inline const static std::string VARIABLE_DELIMITER = ";"; 112 | inline const static std::string VARIABLE_PARAMETER_DELIMITER = ","; 113 | 114 | SimConnectVariableParser() = default; 115 | 116 | ~SimConnectVariableParser() = default; 117 | 118 | static inline void ltrim( 119 | std::string &s 120 | ) { 121 | s.erase(s.begin(), find_if(s.begin(), s.end(), [](unsigned char ch) { 122 | return !isspace(ch); 123 | })); 124 | } 125 | 126 | static inline void rtrim( 127 | std::string &s 128 | ) { 129 | s.erase(find_if(s.rbegin(), s.rend(), [](unsigned char ch) { 130 | return !isspace(ch); 131 | }).base(), s.end()); 132 | } 133 | 134 | static inline void trim( 135 | std::string &s 136 | ) { 137 | ltrim(s); 138 | rtrim(s); 139 | } 140 | 141 | }; 142 | -------------------------------------------------------------------------------- /sim-connect-interface/include/SimConnectVariableType.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Andreas Guther 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | namespace simconnect::toolbox::connection { 20 | 21 | enum SIMCONNECT_VARIABLE_TYPE { 22 | SIMCONNECT_VARIABLE_TYPE_INVALID, 23 | SIMCONNECT_VARIABLE_TYPE_BOOL, 24 | SIMCONNECT_VARIABLE_TYPE_INT32, 25 | SIMCONNECT_VARIABLE_TYPE_FLOAT32, 26 | SIMCONNECT_VARIABLE_TYPE_FLOAT64, 27 | SIMCONNECT_VARIABLE_TYPE_LATLONALT, 28 | SIMCONNECT_VARIABLE_TYPE_XYZ, 29 | }; 30 | 31 | class SimConnectVariableType { 32 | public: 33 | SimConnectVariableType() = delete; 34 | 35 | ~SimConnectVariableType() = delete; 36 | 37 | static bool isStruct( 38 | SIMCONNECT_VARIABLE_TYPE type 39 | ) { 40 | switch (type) { 41 | case SIMCONNECT_VARIABLE_TYPE_LATLONALT: 42 | case SIMCONNECT_VARIABLE_TYPE_XYZ: 43 | return true; 44 | 45 | default: 46 | return false; 47 | } 48 | return false; 49 | } 50 | 51 | static SIMCONNECT_DATATYPE convert( 52 | SIMCONNECT_VARIABLE_TYPE type 53 | ) { 54 | switch (type) { 55 | case SIMCONNECT_VARIABLE_TYPE_BOOL: 56 | case SIMCONNECT_VARIABLE_TYPE_INT32: 57 | return SIMCONNECT_DATATYPE_INT32; 58 | 59 | case SIMCONNECT_VARIABLE_TYPE_FLOAT32: 60 | return SIMCONNECT_DATATYPE_FLOAT32; 61 | 62 | case SIMCONNECT_VARIABLE_TYPE_FLOAT64: 63 | return SIMCONNECT_DATATYPE_FLOAT64; 64 | 65 | case SIMCONNECT_VARIABLE_TYPE_LATLONALT: 66 | return SIMCONNECT_DATATYPE_LATLONALT; 67 | 68 | case SIMCONNECT_VARIABLE_TYPE_XYZ: 69 | return SIMCONNECT_DATATYPE_XYZ; 70 | 71 | default: 72 | return SIMCONNECT_DATATYPE_INVALID; 73 | } 74 | } 75 | 76 | static SIMCONNECT_VARIABLE_TYPE convert( 77 | SIMCONNECT_DATATYPE type 78 | ) { 79 | switch (type) { 80 | case SIMCONNECT_DATATYPE_INT32: 81 | return SIMCONNECT_VARIABLE_TYPE_INT32; 82 | 83 | case SIMCONNECT_DATATYPE_FLOAT32: 84 | return SIMCONNECT_VARIABLE_TYPE_FLOAT32; 85 | 86 | case SIMCONNECT_DATATYPE_FLOAT64: 87 | return SIMCONNECT_VARIABLE_TYPE_FLOAT64; 88 | 89 | case SIMCONNECT_DATATYPE_LATLONALT: 90 | return SIMCONNECT_VARIABLE_TYPE_LATLONALT; 91 | 92 | case SIMCONNECT_DATATYPE_XYZ: 93 | return SIMCONNECT_VARIABLE_TYPE_XYZ; 94 | 95 | default: 96 | return SIMCONNECT_VARIABLE_TYPE_INVALID; 97 | } 98 | } 99 | }; 100 | 101 | } 102 | -------------------------------------------------------------------------------- /sim-connect-interface/src/SimConnectData.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Andreas Guther 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include "SimConnectData.h" 19 | 20 | using namespace simconnect::toolbox::connection; 21 | 22 | SimConnectData::SimConnectData( 23 | const SimConnectDataDefinition &dataDefinition 24 | ) : dataDefinition(dataDefinition), indexMapping() { 25 | // get counts 26 | memberCount = getMemberCountFromDataDefinition(dataDefinition); 27 | 28 | // get total size 29 | totalSize = getTotalSize(memberCount); 30 | 31 | // allocate buffer and set it to zero 32 | buffer = new char[totalSize]; 33 | std::fill(buffer, buffer + totalSize, 0); 34 | 35 | // setup memory accessors 36 | setupMemoryAccessors(); 37 | } 38 | 39 | SimConnectData::~SimConnectData() { 40 | delete[] buffer; 41 | buffer = nullptr; 42 | } 43 | 44 | SimConnectData::MemberCount SimConnectData::getMemberCountFromDataDefinition( 45 | SimConnectDataDefinition _dataDefinition 46 | ) { 47 | MemberCount count = {}; 48 | for (int index = 0; index < _dataDefinition.size(); ++index) { 49 | switch (_dataDefinition.getType(index)) { 50 | case SIMCONNECT_VARIABLE_TYPE_BOOL: 51 | indexMapping.push_back(count.countBoolean); 52 | count.countBoolean++; 53 | break; 54 | case SIMCONNECT_VARIABLE_TYPE_INT32: 55 | indexMapping.push_back(count.countInt32); 56 | count.countInt32++; 57 | break; 58 | case SIMCONNECT_VARIABLE_TYPE_FLOAT32: 59 | indexMapping.push_back(count.countFloat32); 60 | count.countFloat32++; 61 | break; 62 | case SIMCONNECT_VARIABLE_TYPE_FLOAT64: 63 | indexMapping.push_back(count.countFloat64); 64 | count.countFloat64++; 65 | break; 66 | case SIMCONNECT_VARIABLE_TYPE_LATLONALT: 67 | indexMapping.push_back(count.countLatLonAlt); 68 | count.countLatLonAlt++; 69 | break; 70 | case SIMCONNECT_VARIABLE_TYPE_XYZ: 71 | indexMapping.push_back(count.countXYZ); 72 | count.countXYZ++; 73 | break; 74 | 75 | default: 76 | break; 77 | } 78 | } 79 | return count; 80 | } 81 | 82 | size_t SimConnectData::getTotalSize( 83 | MemberCount counts 84 | ) { 85 | size_t size = 0; 86 | size += MemoryAccessor::getSizeWithPadding(counts.countBoolean, 4); 87 | size += MemoryAccessor::getSizeWithPadding(counts.countInt32, 8); 88 | size += MemoryAccessor::getSizeWithPadding(counts.countFloat32, 8); 89 | size += MemoryAccessor::getSizeWithPadding(counts.countFloat64, 8); 90 | size += MemoryAccessor::getSizeWithPadding(counts.countLatLonAlt, 8); 91 | size += MemoryAccessor::getSizeWithPadding(counts.countXYZ, 8); 92 | return size; 93 | } 94 | 95 | char *SimConnectData::getBuffer() { 96 | return buffer; 97 | } 98 | 99 | void SimConnectData::setupMemoryAccessors() { 100 | // variable for offset 101 | size_t offset = 0; 102 | if (memberCount.countBoolean > 0) { 103 | memoryAccessorBoolean = std::make_shared>( 104 | buffer + offset, 105 | memberCount.countBoolean 106 | ); 107 | offset += MemoryAccessor::getSizeWithPadding(memberCount.countBoolean, 4); 108 | } 109 | if (memberCount.countInt32 > 0) { 110 | memoryAccessorInt32 = std::make_shared>( 111 | buffer + offset, 112 | memberCount.countInt32 113 | ); 114 | offset += MemoryAccessor::getSizeWithPadding(memberCount.countInt32, 8); 115 | } 116 | if (memberCount.countFloat32 > 0) { 117 | memoryAccessorFloat32 = std::make_shared>( 118 | buffer + offset, 119 | memberCount.countFloat32 120 | ); 121 | offset += MemoryAccessor::getSizeWithPadding(memberCount.countFloat32, 8); 122 | } 123 | if (memberCount.countFloat64 > 0) { 124 | memoryAccessorFloat64 = std::make_shared>( 125 | buffer + offset, 126 | memberCount.countFloat64 127 | ); 128 | offset += MemoryAccessor::getSizeWithPadding(memberCount.countFloat64, 8); 129 | } 130 | if (memberCount.countLatLonAlt > 0) { 131 | memoryAccessorLatLonAlt = std::make_shared>( 132 | buffer + offset, 133 | memberCount.countLatLonAlt 134 | ); 135 | offset += MemoryAccessor::getSizeWithPadding(memberCount.countLatLonAlt, 8); 136 | } 137 | if (memberCount.countXYZ > 0) { 138 | memoryAccessorXYZ = std::make_shared>( 139 | buffer + offset, 140 | memberCount.countXYZ 141 | ); 142 | offset += MemoryAccessor::getSizeWithPadding(memberCount.countXYZ, 8); 143 | } 144 | 145 | // ensure total size and offset is matching 146 | if (offset != totalSize) { 147 | throw std::exception("Offset and total size are different!"); 148 | } 149 | } 150 | 151 | size_t SimConnectData::size() const { 152 | return totalSize; 153 | } 154 | 155 | std::any SimConnectData::get( 156 | size_t index 157 | ) { 158 | switch (dataDefinition.getType(index)) { 159 | case SIMCONNECT_VARIABLE_TYPE_BOOL: 160 | return static_cast(memoryAccessorBoolean->get(indexMapping[index])); 161 | case SIMCONNECT_VARIABLE_TYPE_INT32: 162 | return memoryAccessorInt32->get(indexMapping[index]); 163 | case SIMCONNECT_VARIABLE_TYPE_FLOAT32: 164 | return memoryAccessorFloat32->get(indexMapping[index]); 165 | case SIMCONNECT_VARIABLE_TYPE_FLOAT64: 166 | return memoryAccessorFloat64->get(indexMapping[index]); 167 | case SIMCONNECT_VARIABLE_TYPE_LATLONALT: 168 | return memoryAccessorLatLonAlt->get(indexMapping[index]); 169 | case SIMCONNECT_VARIABLE_TYPE_XYZ: 170 | return memoryAccessorXYZ->get(indexMapping[index]); 171 | default: 172 | throw std::exception("No item found!"); 173 | } 174 | } 175 | 176 | void SimConnectData::set( 177 | size_t index, 178 | std::any value 179 | ) { 180 | switch (dataDefinition.getType(index)) { 181 | case SIMCONNECT_VARIABLE_TYPE_BOOL: 182 | memoryAccessorBoolean->set(indexMapping[index], std::any_cast(value)); 183 | break; 184 | case SIMCONNECT_VARIABLE_TYPE_INT32: 185 | memoryAccessorInt32->set(indexMapping[index], std::any_cast(value)); 186 | break; 187 | case SIMCONNECT_VARIABLE_TYPE_FLOAT32: 188 | memoryAccessorFloat32->set(indexMapping[index], std::any_cast(value)); 189 | break; 190 | case SIMCONNECT_VARIABLE_TYPE_FLOAT64: 191 | memoryAccessorFloat64->set(indexMapping[index], std::any_cast(value)); 192 | break; 193 | case SIMCONNECT_VARIABLE_TYPE_LATLONALT: 194 | memoryAccessorLatLonAlt->set(indexMapping[index], std::any_cast(value)); 195 | break; 196 | case SIMCONNECT_VARIABLE_TYPE_XYZ: 197 | memoryAccessorXYZ->set(indexMapping[index], std::any_cast(value)); 198 | break; 199 | default: 200 | throw std::exception("Parameter not known!"); 201 | } 202 | } 203 | 204 | void SimConnectData::copy( 205 | char *pBuffer 206 | ) { 207 | memcpy_s(this->buffer, totalSize, pBuffer, totalSize); 208 | } 209 | -------------------------------------------------------------------------------- /sim-connect-interface/src/SimConnectDataDefinition.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Andreas Guther 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include "SimConnectDataDefinition.h" 20 | 21 | using namespace std; 22 | using namespace simconnect::toolbox::connection; 23 | 24 | SimConnectDataDefinition::SimConnectDataDefinition() : variables() { 25 | } 26 | 27 | SimConnectDataDefinition::SimConnectDataDefinition( 28 | const SimConnectDataDefinition &other 29 | ) { 30 | variables.clear(); 31 | for (const auto &variable : other.variables) { 32 | variables.push_back(variable); 33 | } 34 | } 35 | 36 | SimConnectDataDefinition &SimConnectDataDefinition::operator=( 37 | const SimConnectDataDefinition &other 38 | ) { 39 | variables.clear(); 40 | for (const auto &variable : other.variables) { 41 | variables.push_back(variable); 42 | } 43 | return *this; 44 | } 45 | 46 | SimConnectDataDefinition::~SimConnectDataDefinition() = default; 47 | 48 | void SimConnectDataDefinition::add( 49 | const SimConnectVariable &item 50 | ) { 51 | if (!SimConnectVariableLookupTable::isKnown(item)) { 52 | throw std::invalid_argument("Variable is not known!"); 53 | } 54 | variables.push_back(item); 55 | } 56 | 57 | SimConnectVariable SimConnectDataDefinition::get( 58 | size_t index 59 | ) { 60 | return variables[index]; 61 | } 62 | 63 | size_t SimConnectDataDefinition::size() { 64 | return variables.size(); 65 | } 66 | 67 | SIMCONNECT_VARIABLE_TYPE SimConnectDataDefinition::getType( 68 | size_t index 69 | ) { 70 | return getType(get(index)); 71 | } 72 | 73 | SIMCONNECT_VARIABLE_TYPE SimConnectDataDefinition::getType( 74 | const SimConnectVariable &item 75 | ) { 76 | return SimConnectVariableLookupTable::getDataType(item); 77 | } 78 | -------------------------------------------------------------------------------- /sim-connect-interface/src/SimConnectDataInterface.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Andreas Guther 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include "SimConnectDataInterface.h" 20 | 21 | using namespace std; 22 | using namespace simconnect::toolbox::connection; 23 | 24 | bool SimConnectDataInterface::connect( 25 | int configurationIndex, 26 | const string &name, 27 | const SimConnectDataDefinition &dataDefinition, 28 | const shared_ptr &simConnectData 29 | ) { 30 | // store connection name 31 | connectionName = name; 32 | 33 | // connect 34 | HRESULT result = SimConnect_Open( 35 | &hSimConnect, 36 | connectionName.c_str(), 37 | nullptr, 38 | 0, 39 | nullptr, 40 | configurationIndex 41 | ); 42 | 43 | if (S_OK == result) { 44 | // we are now connected 45 | isConnected = true; 46 | // store data object 47 | this->data = simConnectData; 48 | // add data to definition 49 | if (!prepareDataDefinition(hSimConnect, 0, dataDefinition)) { 50 | // failed to add data definition -> disconnect 51 | disconnect(); 52 | // failed to connect 53 | return false; 54 | } 55 | // success 56 | return true; 57 | } 58 | // fallback -> failed 59 | return false; 60 | } 61 | 62 | void SimConnectDataInterface::disconnect() { 63 | if (isConnected) { 64 | // close connection 65 | SimConnect_Close(hSimConnect); 66 | // set flag 67 | isConnected = false; 68 | // reset data object 69 | data.reset(); 70 | // reset handle 71 | hSimConnect = nullptr; 72 | } 73 | } 74 | 75 | bool SimConnectDataInterface::requestReadData() { 76 | // check if we are connected 77 | if (!isConnected) { 78 | return false; 79 | } 80 | 81 | // request data 82 | if (!requestData()) { 83 | return false; 84 | } 85 | 86 | // read data 87 | if (!readData()) { 88 | return false; 89 | } 90 | 91 | // success 92 | return true; 93 | } 94 | 95 | bool SimConnectDataInterface::requestData() { 96 | // check if we are connected 97 | if (!isConnected) { 98 | return false; 99 | } 100 | 101 | // request data 102 | HRESULT result = SimConnect_RequestDataOnSimObjectType( 103 | hSimConnect, 104 | 0, 105 | 0, 106 | 0, 107 | SIMCONNECT_SIMOBJECT_TYPE_USER 108 | ); 109 | 110 | // check result of data request 111 | if (result != S_OK) { 112 | // request failed 113 | return false; 114 | } 115 | 116 | // success 117 | return true; 118 | } 119 | 120 | bool SimConnectDataInterface::readData() { 121 | // check if we are connected 122 | if (!isConnected) { 123 | return false; 124 | } 125 | 126 | // get next dispatch message(s) and process them 127 | DWORD cbData; 128 | SIMCONNECT_RECV *pData; 129 | while (SUCCEEDED(SimConnect_GetNextDispatch(hSimConnect, &pData, &cbData))) { 130 | simConnectProcessDispatchMessage(pData, &cbData); 131 | } 132 | 133 | // success 134 | return true; 135 | } 136 | 137 | bool SimConnectDataInterface::sendData() { 138 | // check if we are connected 139 | if (!isConnected) { 140 | return false; 141 | } 142 | 143 | // set output data 144 | HRESULT result = SimConnect_SetDataOnSimObject( 145 | hSimConnect, 146 | 0, 147 | SIMCONNECT_OBJECT_ID_USER, 148 | 0, 149 | 0, 150 | static_cast(data->size()), 151 | data->getBuffer() 152 | ); 153 | 154 | // check result of data request 155 | if (result != S_OK) { 156 | // request failed 157 | return false; 158 | } 159 | 160 | // success 161 | return true; 162 | } 163 | 164 | void SimConnectDataInterface::simConnectProcessDispatchMessage( 165 | SIMCONNECT_RECV *pData, 166 | DWORD *cbData 167 | ) { 168 | switch (pData->dwID) { 169 | case SIMCONNECT_RECV_ID_OPEN: 170 | // connection established 171 | cout << "SimConnect connection established ('" << connectionName << "')" << endl; 172 | break; 173 | 174 | case SIMCONNECT_RECV_ID_QUIT: 175 | // connection lost 176 | cout << "Closed SimConnect connection ('" << connectionName << "')" << endl; 177 | disconnect(); 178 | break; 179 | 180 | case SIMCONNECT_RECV_ID_SIMOBJECT_DATA_BYTYPE: 181 | // process data 182 | simConnectProcessSimObjectDataByType(pData); 183 | break; 184 | 185 | case SIMCONNECT_RECV_ID_EXCEPTION: 186 | // exception 187 | cout << "Exception in SimConnect connection ('" << connectionName << "'): "; 188 | cout << ((SIMCONNECT_RECV_EXCEPTION *) pData)->dwException << endl; 189 | break; 190 | 191 | default: 192 | break; 193 | } 194 | } 195 | 196 | void SimConnectDataInterface::simConnectProcessSimObjectDataByType( 197 | const SIMCONNECT_RECV *pData 198 | ) { 199 | // get data object 200 | auto *simObjectDataByType = (SIMCONNECT_RECV_SIMOBJECT_DATA_BYTYPE *) pData; 201 | 202 | // process depending on request id 203 | switch (simObjectDataByType->dwRequestID) { 204 | case 0: 205 | // store aircraft data 206 | data->copy(reinterpret_cast(&simObjectDataByType->dwData)); 207 | break; 208 | 209 | default: 210 | // print unknown request id 211 | cout << "Unknown request id in SimConnect connection ('" << connectionName << "'): "; 212 | cout << simObjectDataByType->dwRequestID << endl; 213 | break; 214 | } 215 | } 216 | 217 | bool SimConnectDataInterface::prepareDataDefinition( 218 | HANDLE connectionHandle, 219 | SIMCONNECT_DATA_DEFINITION_ID id, 220 | SimConnectDataDefinition dataDefinition 221 | ) { 222 | // map for right order of data definitions 223 | map> dataDefinitionMap; 224 | for (int i = 0; i < dataDefinition.size(); ++i) { 225 | dataDefinitionMap[dataDefinition.getType(i)].push_back(dataDefinition.get(i)); 226 | } 227 | 228 | // add data definitions 229 | bool result = addDataDefinition( 230 | connectionHandle, 231 | id, 232 | SIMCONNECT_VARIABLE_TYPE_BOOL, 233 | dataDefinitionMap[SIMCONNECT_VARIABLE_TYPE_BOOL] 234 | ); 235 | if (!result) return false; 236 | 237 | result = addDataDefinition( 238 | connectionHandle, 239 | id, 240 | SIMCONNECT_VARIABLE_TYPE_INT32, 241 | dataDefinitionMap[SIMCONNECT_VARIABLE_TYPE_INT32] 242 | ); 243 | if (!result) return false; 244 | 245 | result = addDataDefinition( 246 | connectionHandle, 247 | id, 248 | SIMCONNECT_VARIABLE_TYPE_FLOAT32, 249 | dataDefinitionMap[SIMCONNECT_VARIABLE_TYPE_FLOAT32] 250 | ); 251 | if (!result) return false; 252 | 253 | result = addDataDefinition( 254 | connectionHandle, 255 | id, 256 | SIMCONNECT_VARIABLE_TYPE_FLOAT64, 257 | dataDefinitionMap[SIMCONNECT_VARIABLE_TYPE_FLOAT64] 258 | ); 259 | if (!result) return false; 260 | 261 | result = addDataDefinition( 262 | connectionHandle, 263 | id, 264 | SIMCONNECT_VARIABLE_TYPE_LATLONALT, 265 | dataDefinitionMap[SIMCONNECT_VARIABLE_TYPE_LATLONALT] 266 | ); 267 | if (!result) return false; 268 | 269 | result = addDataDefinition( 270 | connectionHandle, 271 | id, 272 | SIMCONNECT_VARIABLE_TYPE_XYZ, 273 | dataDefinitionMap[SIMCONNECT_VARIABLE_TYPE_XYZ] 274 | ); 275 | if (!result) return false; 276 | 277 | // success 278 | return true; 279 | } 280 | 281 | bool SimConnectDataInterface::addDataDefinition( 282 | HANDLE connectionHandle, 283 | SIMCONNECT_DATA_DEFINITION_ID id, 284 | SIMCONNECT_VARIABLE_TYPE dataType, 285 | const vector &variables 286 | ) { 287 | for (auto &variable : variables) { 288 | HRESULT result = SimConnect_AddToDataDefinition( 289 | connectionHandle, 290 | id, 291 | variable.name.c_str(), 292 | SimConnectVariableType::isStruct(dataType) ? nullptr : variable.unit.c_str(), 293 | SimConnectVariableType::convert(dataType) 294 | ); 295 | if (result != S_OK) { 296 | // failed -> abort 297 | return false; 298 | } 299 | } 300 | return true; 301 | } 302 | -------------------------------------------------------------------------------- /sim-connect-interface/src/SimConnectInputInterface.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Andreas Guther 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include "SimConnectInputInterface.h" 20 | 21 | using namespace std; 22 | using namespace simconnect::toolbox::connection; 23 | 24 | bool SimConnectInputInterface::connect( 25 | int configurationIndex, 26 | const string &name, 27 | const SimConnectDataDefinition &dataDefinition, 28 | const shared_ptr &simConnectData, 29 | const DWORD priority 30 | ) { 31 | // store connection name 32 | connectionName = name; 33 | 34 | // connect 35 | HRESULT result = SimConnect_Open( 36 | &hSimConnect, 37 | connectionName.c_str(), 38 | nullptr, 39 | 0, 40 | nullptr, 41 | configurationIndex 42 | ); 43 | 44 | if (S_OK == result) { 45 | // we are now connected 46 | isConnected = true; 47 | // store data object 48 | this->data = simConnectData; 49 | // add data to definition 50 | if (!prepareDataDefinition(hSimConnect, 0, dataDefinition, priority)) { 51 | // failed to add data definition -> disconnect 52 | disconnect(); 53 | // failed to connect 54 | return false; 55 | } 56 | // success 57 | return true; 58 | } 59 | // fallback -> failed 60 | return false; 61 | } 62 | 63 | void SimConnectInputInterface::disconnect() { 64 | if (isConnected) { 65 | // close connection 66 | SimConnect_Close(hSimConnect); 67 | // set flag 68 | isConnected = false; 69 | // reset data object 70 | data.reset(); 71 | // reset handle 72 | hSimConnect = nullptr; 73 | } 74 | } 75 | 76 | bool SimConnectInputInterface::readData() { 77 | // check if we are connected 78 | if (!isConnected) { 79 | return false; 80 | } 81 | 82 | // get next dispatch message(s) and process them 83 | DWORD cbData; 84 | SIMCONNECT_RECV *pData; 85 | while (SUCCEEDED(SimConnect_GetNextDispatch(hSimConnect, &pData, &cbData))) { 86 | simConnectProcessDispatchMessage(pData, &cbData); 87 | } 88 | 89 | // success 90 | return true; 91 | } 92 | 93 | void SimConnectInputInterface::simConnectProcessDispatchMessage( 94 | SIMCONNECT_RECV *pData, 95 | DWORD *cbData 96 | ) { 97 | switch (pData->dwID) { 98 | case SIMCONNECT_RECV_ID_OPEN: 99 | // connection established 100 | cout << "SimConnect connection established ('" << connectionName << "')" << endl; 101 | break; 102 | 103 | case SIMCONNECT_RECV_ID_EVENT: 104 | // get event 105 | simConnectProcessEvent(pData); 106 | break; 107 | 108 | case SIMCONNECT_RECV_ID_QUIT: 109 | // connection lost 110 | cout << "Closed SimConnect connection ('" << connectionName << "')" << endl; 111 | disconnect(); 112 | break; 113 | 114 | case SIMCONNECT_RECV_ID_EXCEPTION: 115 | // exception 116 | cout << "Exception in SimConnect connection ('" << connectionName << "'): "; 117 | cout << ((SIMCONNECT_RECV_EXCEPTION *) pData)->dwException << endl; 118 | break; 119 | 120 | default: 121 | break; 122 | } 123 | } 124 | 125 | void SimConnectInputInterface::simConnectProcessEvent( 126 | const SIMCONNECT_RECV *pData 127 | ) { 128 | // get event 129 | auto *event = (SIMCONNECT_RECV_EVENT *) pData; 130 | 131 | // process depending on event id 132 | data->set(event->uEventID, static_cast(event->dwData) / 16384.0); 133 | } 134 | 135 | bool SimConnectInputInterface::prepareDataDefinition( 136 | HANDLE connectionHandle, 137 | SIMCONNECT_DATA_DEFINITION_ID id, 138 | SimConnectDataDefinition dataDefinition, 139 | DWORD priority 140 | ) { 141 | // iterate over data definitions 142 | for (int i = 0; i < dataDefinition.size(); ++i) { 143 | bool result = addDataDefinition( 144 | connectionHandle, 145 | id, 146 | i, 147 | dataDefinition.get(i), 148 | priority 149 | ); 150 | if (!result) return false; 151 | } 152 | 153 | // success 154 | return true; 155 | } 156 | 157 | bool SimConnectInputInterface::addDataDefinition( 158 | HANDLE connectionHandle, 159 | SIMCONNECT_DATA_DEFINITION_ID groupId, 160 | SIMCONNECT_CLIENT_EVENT_ID eventId, 161 | const SimConnectVariable &variable, 162 | DWORD priority 163 | ) { 164 | HRESULT result = SimConnect_MapClientEventToSimEvent( 165 | connectionHandle, 166 | eventId, 167 | variable.name.c_str() 168 | ); 169 | if (result != S_OK) { 170 | // failed -> abort 171 | return false; 172 | } 173 | 174 | result = SimConnect_AddClientEventToNotificationGroup( 175 | connectionHandle, 176 | groupId, 177 | eventId, 178 | variable.unit == "TRUE" ? TRUE : FALSE 179 | ); 180 | if (result != S_OK) { 181 | // failed -> abort 182 | return false; 183 | } 184 | 185 | result = SimConnect_SetNotificationGroupPriority( 186 | connectionHandle, 187 | groupId, 188 | priority 189 | ); 190 | if (result != S_OK) { 191 | // failed -> abort 192 | return false; 193 | } 194 | 195 | // success 196 | return true; 197 | } 198 | -------------------------------------------------------------------------------- /sim-connect-interface/src/SimConnectVariableLookupTable.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Andreas Guther 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include 19 | #include "SimConnectVariableLookupTable.h" 20 | 21 | using namespace std; 22 | using namespace simconnect::toolbox::connection; 23 | 24 | bool SimConnectVariableLookupTable::isLvar( 25 | const SimConnectVariable &item 26 | ) { 27 | return regex_search(item.name, regex("^L:")); 28 | } 29 | 30 | bool SimConnectVariableLookupTable::isKnown( 31 | const SimConnectVariable &item 32 | ) { 33 | return LOOKUP_TABLE.find(normalizeName(item.name)) != LOOKUP_TABLE.end() || SimConnectVariableLookupTable::isLvar(item); 34 | } 35 | 36 | SIMCONNECT_VARIABLE_TYPE SimConnectVariableLookupTable::getDataType( 37 | const SimConnectVariable &item 38 | ) { 39 | // check if variable is an Lvar. All Lvars are of type F64, so return that. 40 | if (SimConnectVariableLookupTable::isLvar(item)) { 41 | return SIMCONNECT_VARIABLE_TYPE_FLOAT64; 42 | } 43 | 44 | // check if variable is known 45 | if (!isKnown(item)) { 46 | throw invalid_argument("The variable is not known!"); 47 | } 48 | // return data type that is mapped to variable 49 | return LOOKUP_TABLE.at(normalizeName(item.name)); 50 | } 51 | 52 | string SimConnectVariableLookupTable::normalizeName( 53 | const string &itemName 54 | ) { 55 | // this is needed to support indexed variables 56 | return regex_replace(itemName, regex("(.*)(:[0-9]+)"), "$1"); 57 | } 58 | -------------------------------------------------------------------------------- /simconnect-toolbox.prj: -------------------------------------------------------------------------------- 1 | 2 | 3 | SimConnect Toolbox 4 | Andreas Guther 5 | 6 | 7 | This toolbox allows to connect to Microsoft Flight Simulator 2020 using SimConnect. 8 | This toolbox allows to connect to Microsoft Flight Simulator 2020 using SimConnect. It might be necessary that the toolbox directory need to be added to your user profile path. 9 | 10 | See also here: 11 | https://github.com/aguther/simconnect-toolbox 12 | 13 | 1.1.1 14 | ${PROJECT_ROOT}\SimConnect Toolbox.mltbx 15 | 16 | MATLAB 17 | Simulink 18 | 19 | 20 | 1 21 | 2 22 | 23 | 24 | 9.9 25 | 10.2 26 | 27 | 28 | 5dee2502-da2f-4bea-b7bf-701845f30184 29 | 30 | true 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | false 40 | 41 | 42 | 43 | R2019b 44 | latest 45 | false 46 | true 47 | false 48 | false 49 | false 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | ${PROJECT_ROOT}\matlab 87 | 88 | 89 | ${PROJECT_ROOT}\matlab\BlockFactory.mexw64 90 | ${PROJECT_ROOT}\matlab\BlockFactoryCore.dll 91 | ${PROJECT_ROOT}\matlab\mxpp.dll 92 | ${PROJECT_ROOT}\matlab\shlibpp.dll 93 | ${PROJECT_ROOT}\matlab\SimConnect.cfg 94 | ${PROJECT_ROOT}\matlab\SimConnect.dll 95 | ${PROJECT_ROOT}\matlab\SimConnectInterface.dll 96 | ${PROJECT_ROOT}\matlab\SimConnectToolbox.dll 97 | ${PROJECT_ROOT}\matlab\SimConnectToolbox.slx 98 | ${PROJECT_ROOT}\matlab\SimConnectToolboxExample.slx 99 | ${PROJECT_ROOT}\matlab\slblocks.m 100 | 101 | 102 | 103 | 104 | 105 | C:\Users\Andreas\git\msfs\simconnect-toolbox\SimConnect Toolbox.mltbx 106 | 107 | 108 | 109 | C:\Program Files\MATLAB\R2020b 110 | 111 | 112 | 113 | false 114 | false 115 | true 116 | false 117 | false 118 | false 119 | false 120 | false 121 | 10.0 122 | false 123 | true 124 | win64 125 | true 126 | 127 | 128 | -------------------------------------------------------------------------------- /src/Factory/Factory.cpp: -------------------------------------------------------------------------------- 1 | #include "SimConnectInput.h" 2 | #include "SimConnectSink.h" 3 | #include "SimConnectSource.h" 4 | 5 | #pragma warning(disable : 4267) 6 | #pragma warning(disable : 4996) 7 | 8 | // Class factory API 9 | #include 10 | 11 | SHLIBPP_DEFINE_SHARED_SUBCLASS( 12 | SimConnectInput, 13 | simconnect::toolbox::blocks::SimConnectInput, 14 | blockfactory::core::Block 15 | ); 16 | 17 | SHLIBPP_DEFINE_SHARED_SUBCLASS( 18 | SimConnectSink, 19 | simconnect::toolbox::blocks::SimConnectSink, 20 | blockfactory::core::Block 21 | ); 22 | 23 | SHLIBPP_DEFINE_SHARED_SUBCLASS( 24 | SimConnectSource, 25 | simconnect::toolbox::blocks::SimConnectSource, 26 | blockfactory::core::Block 27 | ); 28 | -------------------------------------------------------------------------------- /src/SimConnectInput/SimConnectInput.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Andreas Guther 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "SimConnectInput.h" 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | using namespace blockfactory::core; 25 | using namespace simconnect::toolbox::blocks; 26 | using namespace simconnect::toolbox::connection; 27 | 28 | unsigned SimConnectInput::numberOfParameters() { 29 | return Block::numberOfParameters() + 3; 30 | } 31 | 32 | bool SimConnectInput::parseParameters( 33 | BlockInformation *blockInfo 34 | ) { 35 | // get base index 36 | unsigned int index = Block::numberOfParameters(); 37 | 38 | // define parameters 39 | const std::vector metadata{ 40 | {ParameterType::INT, index++, 1, 1, "ConfigurationIndex"}, 41 | {ParameterType::STRING, index++, 1, 1, "ConnectionName"}, 42 | {ParameterType::STRING, index++, 1, 1, "Variables"} 43 | }; 44 | 45 | // add parameters 46 | for (const auto &md : metadata) { 47 | if (!blockInfo->addParameterMetadata(md)) { 48 | bfError << "Failed to store parameter metadata"; 49 | return false; 50 | } 51 | } 52 | 53 | return blockInfo->parseParameters(m_parameters); 54 | } 55 | 56 | bool SimConnectInput::configureSizeAndPorts( 57 | BlockInformation *blockInfo 58 | ) { 59 | if (!Block::configureSizeAndPorts(blockInfo)) { 60 | return false; 61 | } 62 | 63 | // parse the parameters 64 | if (!SimConnectInput::parseParameters(blockInfo)) { 65 | bfError << "Failed to parse parameters."; 66 | return false; 67 | } 68 | // store together the port information objects 69 | InputPortsInfo inputPortInfo; 70 | OutputPortsInfo outputPortInfo; 71 | 72 | // read variables parameter 73 | std::string parameterVariables; 74 | if (!m_parameters.getParameter("Variables", parameterVariables)) { 75 | bfError << "Failed to parse Operation parameter"; 76 | return false; 77 | } 78 | 79 | // get output count 80 | try { 81 | auto variables = SimConnectVariableParser::getSimConnectVariablesFromParameterString(parameterVariables); 82 | for (unsigned long long kI = 0; kI < variables.size(); ++kI) { 83 | switch (SimConnectVariableLookupTable::getDataType(variables[kI])) { 84 | case SIMCONNECT_VARIABLE_TYPE_FLOAT64: 85 | outputPortInfo.push_back( 86 | { 87 | kI, 88 | {1}, 89 | Port::DataType::DOUBLE 90 | } 91 | ); 92 | break; 93 | 94 | default: 95 | break; 96 | } 97 | } 98 | } catch (std::exception &ex) { 99 | bfError << "Failed to parse variables: " << ex.what(); 100 | return false; 101 | } 102 | 103 | // store the port information into the BlockInformation 104 | if (!blockInfo->setPortsInfo(inputPortInfo, outputPortInfo)) { 105 | bfError << "Failed to configure input / output ports"; 106 | return false; 107 | } 108 | 109 | return true; 110 | } 111 | 112 | bool SimConnectInput::initialize( 113 | BlockInformation *blockInfo 114 | ) { 115 | // the base Block class need to be initialized first 116 | if (!Block::initialize(blockInfo)) { 117 | return false; 118 | } 119 | 120 | // parse the parameters 121 | if (!SimConnectInput::parseParameters(blockInfo)) { 122 | bfError << "Failed to parse parameters."; 123 | return false; 124 | } 125 | 126 | // read the Operation parameter and store it as a private member 127 | if (!m_parameters.getParameter("ConfigurationIndex", configurationIndex)) { 128 | bfError << "Failed to parse ConfigurationIndex parameter"; 129 | return false; 130 | } 131 | 132 | // read the Operation parameter and store it as a private member 133 | if (!m_parameters.getParameter("ConnectionName", connectionName)) { 134 | bfError << "Failed to parse ConnectionName parameter"; 135 | return false; 136 | } 137 | 138 | // read variables parameter 139 | std::string parameterVariables; 140 | if (!m_parameters.getParameter("Variables", parameterVariables)) { 141 | bfError << "Failed to parse Variables parameter"; 142 | return false; 143 | } 144 | try { 145 | // parse variables and get data definition 146 | auto simConnectVariables = SimConnectVariableParser::getSimConnectVariablesFromParameterString(parameterVariables); 147 | simConnectDataDefinition = SimConnectVariableParser::getSimConnectDataDefinitionFromVariables(simConnectVariables); 148 | 149 | // create data object 150 | simConnectData = std::make_shared(simConnectDataDefinition); 151 | 152 | } catch (std::exception &ex) { 153 | bfError << "Failed to parse variables: " << ex.what(); 154 | return false; 155 | } 156 | 157 | // connect to FS 158 | bool connected = simConnectInterface.connect( 159 | configurationIndex, 160 | connectionName, 161 | simConnectDataDefinition, 162 | simConnectData 163 | ); 164 | if (!connected) { 165 | bfError << "Failed to connect to SimConnect"; 166 | return false; 167 | } 168 | 169 | return true; 170 | } 171 | 172 | bool SimConnectInput::output( 173 | const BlockInformation *blockInfo 174 | ) { 175 | // vector for output signals 176 | std::vector outputSignals; 177 | for (int kI = 0; kI < simConnectDataDefinition.size(); ++kI) { 178 | // get output signal 179 | auto outputSignal = blockInfo->getOutputPortSignal(kI); 180 | // check if output is ok 181 | if (!outputSignal) { 182 | bfError << "Signals not valid"; 183 | return false; 184 | } 185 | // store signal 186 | outputSignals.emplace_back(outputSignal); 187 | } 188 | 189 | // get data from simconnect 190 | if (!simConnectInterface.readData()) { 191 | bfError << "Failed to read data from SimConnect"; 192 | return false; 193 | } 194 | 195 | // write output value to all signals 196 | for (int kI = 0; kI < outputSignals.size(); ++kI) { 197 | switch (simConnectDataDefinition.getType(kI)) { 198 | case SIMCONNECT_VARIABLE_TYPE_FLOAT64: 199 | outputSignals[kI]->set(0, std::any_cast(simConnectData->get(kI))); 200 | break; 201 | 202 | default: 203 | break; 204 | } 205 | } 206 | 207 | // return result 208 | return true; 209 | } 210 | 211 | bool SimConnectInput::terminate( 212 | const BlockInformation *blockInfo 213 | ) { 214 | // disconnect 215 | simConnectInterface.disconnect(); 216 | 217 | // reset simconnect data 218 | simConnectData.reset(); 219 | 220 | // success 221 | return true; 222 | } 223 | -------------------------------------------------------------------------------- /src/SimConnectInput/SimConnectInput.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Andreas Guther 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | namespace simconnect::toolbox::blocks { 28 | class SimConnectInput; 29 | } 30 | 31 | class simconnect::toolbox::blocks::SimConnectInput : public blockfactory::core::Block { 32 | public: 33 | static const std::string ClassName; 34 | 35 | SimConnectInput() = default; 36 | 37 | ~SimConnectInput() override = default; 38 | 39 | unsigned numberOfParameters() override; 40 | 41 | bool parseParameters( 42 | blockfactory::core::BlockInformation *blockInfo 43 | ) override; 44 | 45 | bool configureSizeAndPorts( 46 | blockfactory::core::BlockInformation *blockInfo 47 | ) override; 48 | 49 | bool initialize( 50 | blockfactory::core::BlockInformation *blockInfo 51 | ) override; 52 | 53 | bool output( 54 | const blockfactory::core::BlockInformation *blockInfo 55 | ) override; 56 | 57 | bool terminate( 58 | const blockfactory::core::BlockInformation *blockInfo 59 | ) override; 60 | 61 | private: 62 | int configurationIndex = 0; 63 | std::string connectionName; 64 | std::shared_ptr simConnectData; 65 | simconnect::toolbox::connection::SimConnectDataDefinition simConnectDataDefinition; 66 | simconnect::toolbox::connection::SimConnectInputInterface simConnectInterface; 67 | }; 68 | -------------------------------------------------------------------------------- /src/SimConnectSink/SimConnectSink.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Andreas Guther 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "SimConnectSink.h" 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | using namespace blockfactory::core; 25 | using namespace simconnect::toolbox::blocks; 26 | using namespace simconnect::toolbox::connection; 27 | 28 | unsigned SimConnectSink::numberOfParameters() { 29 | return Block::numberOfParameters() + 3; 30 | } 31 | 32 | bool SimConnectSink::parseParameters( 33 | BlockInformation *blockInfo 34 | ) { 35 | // get base index 36 | unsigned int index = Block::numberOfParameters(); 37 | 38 | // define parameters 39 | const std::vector metadata{ 40 | {ParameterType::INT, index++, 1, 1, "ConfigurationIndex"}, 41 | {ParameterType::STRING, index++, 1, 1, "ConnectionName"}, 42 | {ParameterType::STRING, index++, 1, 1, "Variables"} 43 | }; 44 | 45 | // add parameters 46 | for (const auto &md : metadata) { 47 | if (!blockInfo->addParameterMetadata(md)) { 48 | bfError << "Failed to store parameter metadata"; 49 | return false; 50 | } 51 | } 52 | 53 | return blockInfo->parseParameters(m_parameters); 54 | } 55 | 56 | bool SimConnectSink::configureSizeAndPorts( 57 | BlockInformation *blockInfo 58 | ) { 59 | if (!Block::configureSizeAndPorts(blockInfo)) { 60 | return false; 61 | } 62 | 63 | // parse the parameters 64 | if (!SimConnectSink::parseParameters(blockInfo)) { 65 | bfError << "Failed to parse parameters."; 66 | return false; 67 | } 68 | // store together the port information objects 69 | InputPortsInfo inputPortInfo; 70 | OutputPortsInfo outputPortInfo; 71 | 72 | // read variables parameter 73 | std::string parameterVariables; 74 | if (!m_parameters.getParameter("Variables", parameterVariables)) { 75 | bfError << "Failed to parse Operation parameter"; 76 | return false; 77 | } 78 | 79 | // get output count 80 | try { 81 | auto variables = SimConnectVariableParser::getSimConnectVariablesFromParameterString(parameterVariables); 82 | for (unsigned long long kI = 0; kI < variables.size(); ++kI) { 83 | switch (SimConnectVariableLookupTable::getDataType(variables[kI])) { 84 | case SIMCONNECT_VARIABLE_TYPE_BOOL: 85 | case SIMCONNECT_VARIABLE_TYPE_INT32: 86 | case SIMCONNECT_VARIABLE_TYPE_FLOAT32: 87 | case SIMCONNECT_VARIABLE_TYPE_FLOAT64: 88 | inputPortInfo.push_back( 89 | {kI, 90 | {1}, 91 | Port::DataType::DOUBLE}); 92 | break; 93 | 94 | case SIMCONNECT_VARIABLE_TYPE_LATLONALT: 95 | case SIMCONNECT_VARIABLE_TYPE_XYZ: 96 | inputPortInfo.push_back( 97 | { 98 | kI, 99 | {3}, 100 | Port::DataType::DOUBLE 101 | } 102 | ); 103 | break; 104 | 105 | default: 106 | break; 107 | } 108 | } 109 | } catch (std::exception &ex) { 110 | bfError << "Failed to parse variables: " << ex.what(); 111 | return false; 112 | } 113 | 114 | // store the port information into the BlockInformation 115 | if (!blockInfo->setPortsInfo(inputPortInfo, outputPortInfo)) { 116 | bfError << "Failed to configure input / output ports"; 117 | return false; 118 | } 119 | 120 | return true; 121 | } 122 | 123 | bool SimConnectSink::initialize( 124 | BlockInformation *blockInfo 125 | ) { 126 | // the base Block class need to be initialized first 127 | if (!Block::initialize(blockInfo)) { 128 | return false; 129 | } 130 | 131 | // parse the parameters 132 | if (!SimConnectSink::parseParameters(blockInfo)) { 133 | bfError << "Failed to parse parameters."; 134 | return false; 135 | } 136 | 137 | // read the Operation parameter and store it as a private member 138 | if (!m_parameters.getParameter("ConfigurationIndex", configurationIndex)) { 139 | bfError << "Failed to parse ConfigurationIndex parameter"; 140 | return false; 141 | } 142 | 143 | // read the Operation parameter and store it as a private member 144 | if (!m_parameters.getParameter("ConnectionName", connectionName)) { 145 | bfError << "Failed to parse ConnectionName parameter"; 146 | return false; 147 | } 148 | 149 | // read variables parameter 150 | std::string parameterVariables; 151 | if (!m_parameters.getParameter("Variables", parameterVariables)) { 152 | bfError << "Failed to parse Variables parameter"; 153 | return false; 154 | } 155 | try { 156 | // parse variables and get data definition 157 | auto simConnectVariables = SimConnectVariableParser::getSimConnectVariablesFromParameterString(parameterVariables); 158 | simConnectDataDefinition = SimConnectVariableParser::getSimConnectDataDefinitionFromVariables(simConnectVariables); 159 | 160 | // create data object 161 | simConnectData = std::make_shared(simConnectDataDefinition); 162 | 163 | } catch (std::exception &ex) { 164 | bfError << "Failed to parse variables: " << ex.what(); 165 | return false; 166 | } 167 | 168 | // connect to FS 169 | bool connected = simConnectInterface.connect( 170 | configurationIndex, 171 | connectionName, 172 | simConnectDataDefinition, 173 | simConnectData 174 | ); 175 | if (!connected) { 176 | bfError << "Failed to connect to SimConnect"; 177 | return false; 178 | } 179 | 180 | return true; 181 | } 182 | 183 | bool SimConnectSink::output( 184 | const BlockInformation *blockInfo 185 | ) { 186 | // vector for output signals 187 | std::vector inputSignals; 188 | for (int kI = 0; kI < simConnectDataDefinition.size(); ++kI) { 189 | // get output signal 190 | auto outputSignal = blockInfo->getInputPortSignal(kI); 191 | // check if output is ok 192 | if (!outputSignal) { 193 | bfError << "Signals not valid"; 194 | return false; 195 | } 196 | // store signal 197 | inputSignals.emplace_back(outputSignal); 198 | } 199 | 200 | // write output value to all signals 201 | for (int kI = 0; kI < inputSignals.size(); ++kI) { 202 | switch (simConnectDataDefinition.getType(kI)) { 203 | case SIMCONNECT_VARIABLE_TYPE_BOOL: 204 | simConnectData->set(kI, static_cast(inputSignals[kI]->get(0) != 0)); 205 | break; 206 | 207 | case SIMCONNECT_VARIABLE_TYPE_INT32: 208 | simConnectData->set(kI, static_cast(inputSignals[kI]->get(0))); 209 | break; 210 | 211 | case SIMCONNECT_VARIABLE_TYPE_FLOAT32: 212 | simConnectData->set(kI, static_cast(inputSignals[kI]->get(0))); 213 | break; 214 | 215 | case SIMCONNECT_VARIABLE_TYPE_FLOAT64: 216 | simConnectData->set(kI, inputSignals[kI]->get(0)); 217 | break; 218 | 219 | case SIMCONNECT_VARIABLE_TYPE_LATLONALT: 220 | simConnectData->set( 221 | kI, 222 | SIMCONNECT_DATA_LATLONALT{ 223 | inputSignals[kI]->get(0), 224 | inputSignals[kI]->get(1), 225 | inputSignals[kI]->get(2) 226 | } 227 | ); 228 | break; 229 | 230 | case SIMCONNECT_VARIABLE_TYPE_XYZ: 231 | simConnectData->set( 232 | kI, 233 | SIMCONNECT_DATA_XYZ{ 234 | inputSignals[kI]->get(0), 235 | inputSignals[kI]->get(1), 236 | inputSignals[kI]->get(2) 237 | } 238 | ); 239 | break; 240 | 241 | default: 242 | break; 243 | } 244 | } 245 | 246 | // write data to simconnect 247 | if (!simConnectInterface.sendData()) { 248 | bfError << "Failed to write to SimConnect"; 249 | return false; 250 | } 251 | 252 | // return result 253 | return true; 254 | } 255 | 256 | bool SimConnectSink::terminate( 257 | const BlockInformation *blockInfo 258 | ) { 259 | // disconnect 260 | simConnectInterface.disconnect(); 261 | 262 | // reset simconnect data 263 | simConnectData.reset(); 264 | 265 | // success 266 | return true; 267 | } 268 | -------------------------------------------------------------------------------- /src/SimConnectSink/SimConnectSink.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Andreas Guther 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | namespace simconnect::toolbox::blocks { 28 | class SimConnectSink; 29 | } 30 | 31 | class simconnect::toolbox::blocks::SimConnectSink : public blockfactory::core::Block { 32 | public: 33 | static const std::string ClassName; 34 | 35 | SimConnectSink() = default; 36 | 37 | ~SimConnectSink() override = default; 38 | 39 | unsigned numberOfParameters() override; 40 | 41 | bool parseParameters( 42 | blockfactory::core::BlockInformation *blockInfo 43 | ) override; 44 | 45 | bool configureSizeAndPorts( 46 | blockfactory::core::BlockInformation *blockInfo 47 | ) override; 48 | 49 | bool initialize( 50 | blockfactory::core::BlockInformation *blockInfo 51 | ) override; 52 | 53 | bool output( 54 | const blockfactory::core::BlockInformation *blockInfo 55 | ) override; 56 | 57 | bool terminate( 58 | const blockfactory::core::BlockInformation *blockInfo 59 | ) override; 60 | 61 | private: 62 | int configurationIndex = 0; 63 | std::string connectionName; 64 | std::shared_ptr simConnectData; 65 | simconnect::toolbox::connection::SimConnectDataDefinition simConnectDataDefinition; 66 | simconnect::toolbox::connection::SimConnectDataInterface simConnectInterface; 67 | }; 68 | -------------------------------------------------------------------------------- /src/SimConnectSource/SimConnectSource.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Andreas Guther 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include "SimConnectSource.h" 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | using namespace blockfactory::core; 25 | using namespace simconnect::toolbox::blocks; 26 | using namespace simconnect::toolbox::connection; 27 | 28 | unsigned SimConnectSource::numberOfParameters() { 29 | return Block::numberOfParameters() + 3; 30 | } 31 | 32 | bool SimConnectSource::parseParameters( 33 | BlockInformation *blockInfo 34 | ) { 35 | // get base index 36 | unsigned int index = Block::numberOfParameters(); 37 | 38 | // define parameters 39 | const std::vector metadata{ 40 | {ParameterType::INT, index++, 1, 1, "ConfigurationIndex"}, 41 | {ParameterType::STRING, index++, 1, 1, "ConnectionName"}, 42 | {ParameterType::STRING, index++, 1, 1, "Variables"} 43 | }; 44 | 45 | // add parameters 46 | for (const auto &md : metadata) { 47 | if (!blockInfo->addParameterMetadata(md)) { 48 | bfError << "Failed to store parameter metadata"; 49 | return false; 50 | } 51 | } 52 | 53 | return blockInfo->parseParameters(m_parameters); 54 | } 55 | 56 | bool SimConnectSource::configureSizeAndPorts( 57 | BlockInformation *blockInfo 58 | ) { 59 | if (!Block::configureSizeAndPorts(blockInfo)) { 60 | return false; 61 | } 62 | 63 | // parse the parameters 64 | if (!SimConnectSource::parseParameters(blockInfo)) { 65 | bfError << "Failed to parse parameters."; 66 | return false; 67 | } 68 | // store together the port information objects 69 | InputPortsInfo inputPortInfo; 70 | OutputPortsInfo outputPortInfo; 71 | 72 | // read variables parameter 73 | std::string parameterVariables; 74 | if (!m_parameters.getParameter("Variables", parameterVariables)) { 75 | bfError << "Failed to parse Operation parameter"; 76 | return false; 77 | } 78 | 79 | // get output count 80 | try { 81 | auto variables = SimConnectVariableParser::getSimConnectVariablesFromParameterString(parameterVariables); 82 | for (unsigned long long kI = 0; kI < variables.size(); ++kI) { 83 | switch (SimConnectVariableLookupTable::getDataType(variables[kI])) { 84 | case SIMCONNECT_VARIABLE_TYPE_BOOL: 85 | case SIMCONNECT_VARIABLE_TYPE_INT32: 86 | case SIMCONNECT_VARIABLE_TYPE_FLOAT32: 87 | case SIMCONNECT_VARIABLE_TYPE_FLOAT64: 88 | outputPortInfo.push_back( 89 | { 90 | kI, 91 | {1}, 92 | Port::DataType::DOUBLE 93 | } 94 | ); 95 | break; 96 | 97 | case SIMCONNECT_VARIABLE_TYPE_LATLONALT: 98 | case SIMCONNECT_VARIABLE_TYPE_XYZ: 99 | outputPortInfo.push_back( 100 | { 101 | kI, 102 | {3}, 103 | Port::DataType::DOUBLE 104 | } 105 | ); 106 | break; 107 | 108 | default: 109 | break; 110 | } 111 | } 112 | } catch (std::exception &ex) { 113 | bfError << "Failed to parse variables: " << ex.what(); 114 | return false; 115 | } 116 | 117 | // store the port information into the BlockInformation 118 | if (!blockInfo->setPortsInfo(inputPortInfo, outputPortInfo)) { 119 | bfError << "Failed to configure input / output ports"; 120 | return false; 121 | } 122 | 123 | return true; 124 | } 125 | 126 | bool SimConnectSource::initialize( 127 | BlockInformation *blockInfo 128 | ) { 129 | // the base Block class need to be initialized first 130 | if (!Block::initialize(blockInfo)) { 131 | return false; 132 | } 133 | 134 | // parse the parameters 135 | if (!SimConnectSource::parseParameters(blockInfo)) { 136 | bfError << "Failed to parse parameters."; 137 | return false; 138 | } 139 | 140 | // read the Operation parameter and store it as a private member 141 | if (!m_parameters.getParameter("ConfigurationIndex", configurationIndex)) { 142 | bfError << "Failed to parse ConfigurationIndex parameter"; 143 | return false; 144 | } 145 | 146 | // read the Operation parameter and store it as a private member 147 | if (!m_parameters.getParameter("ConnectionName", connectionName)) { 148 | bfError << "Failed to parse ConnectionName parameter"; 149 | return false; 150 | } 151 | 152 | // read variables parameter 153 | std::string parameterVariables; 154 | if (!m_parameters.getParameter("Variables", parameterVariables)) { 155 | bfError << "Failed to parse Variables parameter"; 156 | return false; 157 | } 158 | try { 159 | // parse variables and get data definition 160 | auto simConnectVariables = SimConnectVariableParser::getSimConnectVariablesFromParameterString(parameterVariables); 161 | simConnectDataDefinition = SimConnectVariableParser::getSimConnectDataDefinitionFromVariables(simConnectVariables); 162 | 163 | // create data object 164 | simConnectData = std::make_shared(simConnectDataDefinition); 165 | 166 | } catch (std::exception &ex) { 167 | bfError << "Failed to parse variables: " << ex.what(); 168 | return false; 169 | } 170 | 171 | // connect to FS 172 | bool connected = simConnectInterface.connect( 173 | configurationIndex, 174 | connectionName, 175 | simConnectDataDefinition, 176 | simConnectData 177 | ); 178 | if (!connected) { 179 | bfError << "Failed to connect to SimConnect"; 180 | return false; 181 | } 182 | 183 | return true; 184 | } 185 | 186 | bool SimConnectSource::output( 187 | const BlockInformation *blockInfo 188 | ) { 189 | // vector for output signals 190 | std::vector outputSignals; 191 | for (int kI = 0; kI < simConnectDataDefinition.size(); ++kI) { 192 | // get output signal 193 | auto outputSignal = blockInfo->getOutputPortSignal(kI); 194 | // check if output is ok 195 | if (!outputSignal) { 196 | bfError << "Signals not valid"; 197 | return false; 198 | } 199 | // store signal 200 | outputSignals.emplace_back(outputSignal); 201 | } 202 | 203 | // get data from simconnect 204 | if (!simConnectInterface.requestData()) { 205 | bfError << "Failed to request data from SimConnect"; 206 | return false; 207 | } 208 | if (!simConnectInterface.readData()) { 209 | bfError << "Failed to read data from SimConnect"; 210 | return false; 211 | } 212 | 213 | // write output value to all signals 214 | for (int kI = 0; kI < outputSignals.size(); ++kI) { 215 | switch (simConnectDataDefinition.getType(kI)) { 216 | case SIMCONNECT_VARIABLE_TYPE_BOOL: 217 | outputSignals[kI]->set(0, std::any_cast(simConnectData->get(kI)) ? 1.0 : 0.0); 218 | break; 219 | 220 | case SIMCONNECT_VARIABLE_TYPE_INT32: 221 | outputSignals[kI]->set(0, static_cast(std::any_cast(simConnectData->get(kI)))); 222 | break; 223 | 224 | case SIMCONNECT_VARIABLE_TYPE_FLOAT32: 225 | outputSignals[kI]->set(0, static_cast(std::any_cast(simConnectData->get(kI)))); 226 | break; 227 | 228 | case SIMCONNECT_VARIABLE_TYPE_FLOAT64: 229 | outputSignals[kI]->set(0, std::any_cast(simConnectData->get(kI))); 230 | break; 231 | 232 | case SIMCONNECT_VARIABLE_TYPE_LATLONALT: 233 | outputSignals[kI]->set(0, std::any_cast(simConnectData->get(kI)).Latitude); 234 | outputSignals[kI]->set(1, std::any_cast(simConnectData->get(kI)).Longitude); 235 | outputSignals[kI]->set(2, std::any_cast(simConnectData->get(kI)).Altitude); 236 | break; 237 | 238 | case SIMCONNECT_VARIABLE_TYPE_XYZ: 239 | outputSignals[kI]->set(0, std::any_cast(simConnectData->get(kI)).x); 240 | outputSignals[kI]->set(1, std::any_cast(simConnectData->get(kI)).y); 241 | outputSignals[kI]->set(2, std::any_cast(simConnectData->get(kI)).z); 242 | break; 243 | 244 | default: 245 | break; 246 | } 247 | } 248 | 249 | // return result 250 | return true; 251 | } 252 | 253 | bool SimConnectSource::terminate( 254 | const BlockInformation *blockInfo 255 | ) { 256 | // disconnect 257 | simConnectInterface.disconnect(); 258 | 259 | // reset simconnect data 260 | simConnectData.reset(); 261 | 262 | // success 263 | return true; 264 | } 265 | -------------------------------------------------------------------------------- /src/SimConnectSource/SimConnectSource.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2020 Andreas Guther 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #pragma once 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | namespace simconnect::toolbox::blocks { 28 | class SimConnectSource; 29 | } 30 | 31 | class simconnect::toolbox::blocks::SimConnectSource : public blockfactory::core::Block { 32 | public: 33 | static const std::string ClassName; 34 | 35 | SimConnectSource() = default; 36 | 37 | ~SimConnectSource() override = default; 38 | 39 | unsigned numberOfParameters() override; 40 | 41 | bool parseParameters( 42 | blockfactory::core::BlockInformation *blockInfo 43 | ) override; 44 | 45 | bool configureSizeAndPorts( 46 | blockfactory::core::BlockInformation *blockInfo 47 | ) override; 48 | 49 | bool initialize( 50 | blockfactory::core::BlockInformation *blockInfo 51 | ) override; 52 | 53 | bool output( 54 | const blockfactory::core::BlockInformation *blockInfo 55 | ) override; 56 | 57 | bool terminate( 58 | const blockfactory::core::BlockInformation *blockInfo 59 | ) override; 60 | 61 | private: 62 | int configurationIndex = 0; 63 | std::string connectionName; 64 | std::shared_ptr simConnectData; 65 | simconnect::toolbox::connection::SimConnectDataDefinition simConnectDataDefinition; 66 | simconnect::toolbox::connection::SimConnectDataInterface simConnectInterface; 67 | }; 68 | --------------------------------------------------------------------------------