You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Navigraph Navigation Data Interface enables developers to download and integrate navigation data from Navigraph directly into add-on aircraft in MSFS.
6
+
<divalign="center">
7
+
<h1>Navigraph Navigation Data Interface for MSFS</h1>
8
+
</div>
9
+
10
+
<p>The Navigraph Navigation Data Interface enables developers to download and integrate navigation data from Navigraph directly into add-on aircraft in MSFS.</p>
11
+
12
+
<br/>
13
+
</div>
4
14
5
15
## Key Features
6
16
7
17
- Navigraph DFD Format: Leverage specialized support for Navigraph's DFD format, based on SQLite, which includes an SQL interface on the commbus for efficient data handling.
8
18
- Javascript and WASM support: The navdata interface is accessible from both Javascript (Coherent) and WASM, providing flexibility for developers.
9
-
- Supports updating of custom data formats.
10
19
- Xbox compatibility: Works on PC and Xbox.
11
20
- Persistence: All data is persisted in the `work` folder of the aircraft.
12
21
13
22
## Repository Structure
14
23
15
-
Here's an overview on the structure of this repository, which is designed to be as simple as possible to use
16
-
17
-
-`examples/`
18
-
- Contains sample implementations for using the navigation data interface
24
+
-`example/`
19
25
-`aircraft/` includes a base aircraft to test in the sim
20
26
-`gauge/` includes a very simple TypeScript instrument to communicate with the WASM module
21
27
-`src/`
22
-
-`database` Includes rust source code for interfacing with a DFD sqlite file (not WASM specific)
23
-
-`js` Includes source code for the JS interface for using the sdk
24
-
-`test` Includes code for testing the JS and Rust code using a Node runtime
25
-
-`wasm` includes the Rust source code for the WASM module which handles the downloading of the database file, and interfacing with the database implementation
28
+
-`ts` includes source code for the JS interface for interfacing with the WASM module
29
+
-`wasm` includes the Rust source code for the WASM module which handles the downloading of the database file, and interfacing with the database
26
30
27
31
## Including in Your Aircraft
28
32
29
33
1. You'll need to either build the WASM module yourself (not recommended, but documented further down) or download it from [the latest release](https://github.com/Navigraph/msfs-navigation-data-interface/releases) (alternatively you can download it off of a commit by looking at the uploaded artifacts).
30
34
2. Add the WASM module into your `panel` folder in `PackageSources`
31
35
3. Add the following entry into `panel.cfg` (make sure to replace `NN` with the proper `VCockpit` ID):
32
36
33
-
```
37
+
```ini
34
38
[VCockpitNN]
35
39
size_mm=0,0
36
40
pixel_size=0,0
@@ -39,89 +43,95 @@ Here's an overview on the structure of this repository, which is designed to be
39
43
```
40
44
41
45
- Note that if you already have a `VCockpit` with `NO_TEXTURE` you can just add another `htmlgauge` to it, while making sure to increase the index
42
-
4.**Optional**: Create a `Navigraph/config.json` file to assist with Sentry reports. This info will be reported to us should any error occur in the library. We will use this to directly reach out to you (the developer) for these errors.
43
46
44
-
- The file must look like
47
+
4.**Optional**: Create a `Navigraph/config.json`file to provide additional metadata at runtime. This info will be reported to us should any error occur in the library, enabling us to directly reach out to you (the developer) to help track down the issue.
45
48
46
-
```json
47
-
{
48
-
"addon": {
49
-
"developer": "Navigraph",
50
-
"product": "Sample Aircraft"
51
-
}
52
-
}
53
-
```
49
+
- The file must follow this format:
50
+
51
+
```json
52
+
{
53
+
"addon": {
54
+
"developer": "Navigraph",
55
+
"product": "Sample Aircraft"
56
+
}
57
+
}
58
+
```
54
59
55
60
## Dealing with Bundled Navigation Data
56
61
57
-
If you bundle outdated navigation data in your aircraft and you want this module to handle updating it for users with subscriptions, place the navigation data into the `Navigraph/BundledData` directory in `PackageSources`. You can see an example [here](examples/aircraft/PackageSources/Navigraph/BundledData/)
62
+
If you bundle outdated navigation data in your aircraft and you want this module to handle updating it for users with subscriptions, place the navigation data into the `Navigraph/BundledData` directory in `PackageSources`. You can see an example [here](example/aircraft/PackageSources/Navigraph/BundledData/)
63
+
64
+
The navigation data interface will automatically use this database by default, making it immediately available on startup.
58
65
59
66
## Where is the Navigation Data Stored?
60
67
61
68
The default location for navigation data is `work/NavigationData`.
62
69
63
-
## Building the Sample Aircraft
70
+
## Building the Sample Aircraft (MSFS2020)
64
71
65
-
Before building, make sure you have properly created and set an `.env` file in `examples/gauge`! An example can be found in the `.env.example` file in that directory. Replace with your credentials
72
+
> [!NOTE]
73
+
> This project is only meant to be tested in MSFS2020. We will add an example for MSFS2024 in the future.
66
74
67
-
1. [Download](https://nodejs.org/en/download) and install Node.js
68
-
2. Open the `msfs-navigation-data-interface` folder in a terminal
69
-
3. Run `npm i` the first time you build, in order to install dependencies
70
-
4. Change directory to `src/js` using `cd src/js`
71
-
5. Run `npm run build` to build the interface.
72
-
6. Change directory to `examples/gauge` using `cd ../../examples/gauge/`
73
-
7. Run `npm run build` to build into the `PackageSources` folder of the aircraft sample (or `npm run dev` to build into the `Packages` folder of the aircraft and listen to changes in the source).
74
-
8. Make sure the WASM module is included in the [`panel`](examples/aircraft/PackageSources/SimObjects/Airplanes/Navigraph_Navigation_Data_Interface_Aircraft/panel) folder! Look at either [Including in Your Aircraft](#including-in-your-aircraft) or [Building the WASM Module Yourself](#building-the-wasm-module-yourself) for info on that
75
-
9. Open the `examples/aircraft/NavigationDataInterfaceAircraftProject.xml` file in the simulator and build there
75
+
> [!IMPORTANT]
76
+
> Before building, make sure you have properly created and set an `.env` file in `example/gauge`! An example can be found in the `.env.example` file in that directory. Replace with your credentials.
77
+
78
+
1. Download and install [Bun](https://bun.sh/docs/installation)
79
+
2. Open this repository in a terminal
80
+
3. Run `bun i` the first time you build, in order to install dependencies
81
+
4. Change directory to [`example/gauge`](example/gauge/) using `cd example/gauge`
82
+
5. Run `bun run build` to build into the `PackageSources` folder of the aircraft sample (or `bun run dev` to build into the `Packages` folder of the aircraft and listen to changes in the source).
83
+
6. Make sure the WASM module is included in the [`panel`](example/aircraft/PackageSources/SimObjects/Airplanes/Navigraph_Navigation_Data_Interface_Aircraft/panel) folder! Look at either [Including in Your Aircraft](#including-in-your-aircraft) or [Building the WASM Module Yourself](#building-the-wasm-module-yourself) instructions
84
+
7. Open the `example/aircraft/NavigationDataInterfaceAircraftProject.xml` file in the simulator and build there
1.Create a `.env` file in the root of this repository, containing a `SENTRY_URL` variable. Provide your own DSN, or leave it empty.
89
+
2. Run `bun run build:wasm`at the root of the repository (requires Docker)
81
90
- This will take a while to download and build the first time, but subsequent runs will be quicker
82
-
3. The compiled WASM module will be copied to `out` **and** `examples/aircraft/PackageSources/SimObjects/Airplanes/Navigraph_Navigation_Data_Interface_Aircraft/panel`
91
+
3. The compiled WASM module will be copied to `dist/wasm`. There will be two folders - `2020`and`2024`, for each sim version
83
92
84
93
## Interfacing with the gauge manually
85
94
86
95
The navigation data interface acts as its own WASM gauge in sim, so in order to communicate with it, you must use the [CommBus](https://docs.flightsimulator.com/html/Programming_Tools/WASM/Communication_API/Communication_API.htm).
87
96
88
-
The gauge communicates using the following event names:
89
-
90
-
(Any types referenced can be found in `wasm/src/json_structs.rs`)
97
+
The gauge communicates using the following event names (all types referenced can be found [here](src/ts)):
91
98
92
-
- `NAVIGRAPH_CallFunction`: This event is received by the interface and is used to trigger one of the interfaces functions. It takes in arguments of type `CallFunction`. The available functions and their expected parameters can be found in the `json_structs.rs` file
99
+
-`NAVIGRAPH_CallFunction`: This event is received by the interface and is used to trigger one of the interfaces functions. It takes in arguments of type `CallFunction`. The available functions and their expected parameters can be found in the [`src/ts`](src/ts) file
93
100
-`NAVIGRAPH_FunctionResult`: This event is sent by the interface as a response to a previously triggered function. Its result will have the type `FunctionResult`, with the data field containing the expected return type of the function.
94
101
-`NAVIGRAPH_Event`: This event is sent by the interface to give indications of progress or that the interface is running correctly.
95
102
96
103
### Example
97
104
98
-
Below is an example of communicating with the interface in JS. (We provide a JS wrapper, the code below is just a basic example to show how it works). Please read the CommBus documentation to determine how to interface with CommBus in your chosen language. `src/js` contains our JS wrapper, it is also a useful example for implementing a fully fleshed out wrapper.
105
+
Below is an example of communicating with the interface in JS. Please read the CommBus documentation to determine how to interface with CommBus in your chosen language. [`src/ts`](src/ts) contains our JS wrapper, it is also a useful example for implementing a fully fleshed out wrapper.
106
+
107
+
> [!IMPORTANT]
108
+
> We provide a JS wrapper that handles this for you. The below is just a quick look at how it works.
0 commit comments