Skip to content

Commit ebf2c03

Browse files
committed
feat: include sample navdata, add more fields
1 parent 5e3bcc3 commit ebf2c03

File tree

4 files changed

+21
-0
lines changed

4 files changed

+21
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"cycle":"2101","revision":"1","name":"Navigraph Avionics", "format": "dfd", "validityPeriod": "2021-01-25/2021-02-20"}
7.44 MB
Binary file not shown.

src/js/types/meta.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ export enum InstallStatus {
77
export interface NavigationDataStatus {
88
status: InstallStatus
99
installedFormat: string | null
10+
installedRegion: string | null
1011
installedCycle: string | null
12+
validityPeriod: string | null
1113
lastestCycle: string | null
1214
}

src/wasm/src/meta.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ pub struct NavigationDataStatus {
2525
pub status: InstallStatus,
2626
#[serde(rename = "installedFormat")]
2727
pub installed_format: Option<String>,
28+
#[serde(rename = "installedRevision")]
29+
pub installed_revision: Option<String>,
2830
#[serde(rename = "installedCycle")]
2931
pub installed_cycle: Option<String>,
32+
#[serde(rename = "validityPeriod")]
33+
pub validity_period: Option<String>,
3034
#[serde(rename = "latestCycle")]
3135
pub latest_cycle: String,
3236
}
@@ -45,6 +49,8 @@ pub struct InstalledNavigationDataCycleInfo {
4549
pub revision: String,
4650
pub name: String,
4751
pub format: String,
52+
#[serde(rename = "validityPeriod")]
53+
pub validity_period: String,
4854
}
4955

5056
pub fn start_network_request(task: Rc<RefCell<Task>>) {
@@ -102,13 +108,17 @@ pub fn get_navigation_data_install_status(task: Rc<RefCell<Task>>) {
102108
InstallStatus::None
103109
};
104110

111+
println!("opening json");
112+
105113
// Open JSON
106114
let json_path = match status {
107115
InstallStatus::Manual => Some(PathBuf::from(consts::NAVIGATION_DATA_DOWNLOADED_LOCATION).join("cycle.json")),
108116
InstallStatus::Bundled => Some(PathBuf::from(consts::NAVIGATION_DATA_DEFAULT_LOCATION).join("cycle.json")),
109117
InstallStatus::None => None,
110118
};
111119

120+
println!("json_path: {:#?}", json_path);
121+
112122
let installed_cycle_info = match json_path {
113123
Some(json_path) => {
114124
let json_file = match std::fs::File::open(json_path) {
@@ -138,10 +148,18 @@ pub fn get_navigation_data_install_status(task: Rc<RefCell<Task>>) {
138148
Some(installed_cycle_info) => Some(installed_cycle_info.format.clone()),
139149
None => None,
140150
},
151+
installed_revision: match &installed_cycle_info {
152+
Some(installed_cycle_info) => Some(installed_cycle_info.revision.clone()),
153+
None => None,
154+
},
141155
installed_cycle: match &installed_cycle_info {
142156
Some(installed_cycle_info) => Some(installed_cycle_info.cycle.clone()),
143157
None => None,
144158
},
159+
validity_period: match &installed_cycle_info {
160+
Some(installed_cycle_info) => Some(installed_cycle_info.validity_period.clone()),
161+
None => None,
162+
},
145163
latest_cycle: response_struct.cycle,
146164
};
147165

0 commit comments

Comments
 (0)