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
Copy file name to clipboardExpand all lines: README.md
+15-12Lines changed: 15 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,13 +21,11 @@
21
21
22
22
## Repository Structure
23
23
24
-
Here's an overview on the structure of this repository, which is designed to be as simple as possible to use
25
-
26
24
-`example/`
27
25
-`aircraft/` includes a base aircraft to test in the sim
28
26
-`gauge/` includes a very simple TypeScript instrument to communicate with the WASM module
29
27
-`src/`
30
-
-`ts`Includes source code for the JS interface for using the sdk
28
+
-`ts`includes source code for the JS interface for interfacing with the WASM module
31
29
-`wasm` includes the Rust source code for the WASM module which handles the downloading of the database file, and interfacing with the database
32
30
33
31
## Including in Your Aircraft
@@ -46,9 +44,9 @@ Here's an overview on the structure of this repository, which is designed to be
46
44
47
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
48
46
49
-
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.
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.
50
48
51
-
- The file must look like
49
+
- The file must follow this format:
52
50
53
51
```json
54
52
{
@@ -61,23 +59,25 @@ Here's an overview on the structure of this repository, which is designed to be
61
59
62
60
## Dealing with Bundled Navigation Data
63
61
64
-
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.
65
65
66
66
## Where is the Navigation Data Stored?
67
67
68
68
The default location for navigation data is `work/NavigationData`.
69
69
70
70
## Building the Sample Aircraft (MSFS2020)
71
71
72
-
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
+
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
73
73
74
74
1. Download and install [Bun](https://bun.sh/docs/installation)
75
75
2. Open the `msfs-navigation-data-interface` folder in a terminal
76
76
3. Run `bun i` the first time you build, in order to install dependencies
77
-
4. Change directory to `examples/gauge` using `cd example/gauge`
77
+
4. Change directory to `example/gauge` using `cd example/gauge`
78
78
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).
79
-
6. 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
80
-
7. Open the `examples/aircraft/NavigationDataInterfaceAircraftProject.xml` file in the simulator and build there
79
+
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) for info on that
80
+
7. Open the `example/aircraft/NavigationDataInterfaceAircraftProject.xml` file in the simulator and build there
81
81
82
82
## Building the WASM Module Yourself
83
83
@@ -92,13 +92,16 @@ The navigation data interface acts as its own WASM gauge in sim, so in order to
92
92
93
93
The gauge communicates using the following event names (all types referenced can be found [here](src/ts)):
94
94
95
-
-`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
95
+
-`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
96
96
-`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.
97
97
-`NAVIGRAPH_Event`: This event is sent by the interface to give indications of progress or that the interface is running correctly.
98
98
99
99
### Example
100
100
101
-
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.
101
+
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.
102
+
103
+
> [!IMPORTANT]
104
+
> We provide a JS wrapper that handles this for you. The below is just a quick look at how it works.
0 commit comments