Skip to content

Commit

Permalink
Add nav data IOD to JSON logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Algafix committed Aug 27, 2024
1 parent 7c3ae6f commit 3fd8c50
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
7 changes: 4 additions & 3 deletions osnma/osnma_core/nav_data_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,11 @@ def _handle_word_type_5(self, word_5_data: BitArray, gst_page: GST):

def add_word(self, word_type: int, page: BitArray, gst_page: GST):

StatusLogger.log_nav_data(self.svid, self.adkd, word_type)
adkd_data = self._get_adkd_data_from_word(page, word_type)

if word_type != 5:
iod = adkd_data[:10]
StatusLogger.log_nav_data_iod(self.svid, iod)
if self._is_new_adkd0_data_block(iod, gst_page):
new_adkd0 = ADKD0DataBlock(gst_page)
new_adkd0.add_word(word_type, adkd_data, gst_page)
Expand Down Expand Up @@ -327,6 +328,8 @@ def __repr__(self):

def add_word(self, word_type: int, full_page: BitArray, gst_page: GST):

StatusLogger.log_nav_data(self.svid, self.adkd, word_type)

new_adkd_data = self._get_adkd_data_from_word(full_page, word_type)
saved_words = self.words_per_type[word_type]

Expand Down Expand Up @@ -431,10 +434,8 @@ def load_page(self, page: BitArray, gst_page: GST, svid: int):
if word_type not in self.active_words:
return
if word_type in WORDS_PER_ADKD[ADKD0]:
StatusLogger.log_nav_data(svid, ADKD0, word_type)
self.adkd0_data_managers[svid].add_word(word_type, page, gst_page)
else:
StatusLogger.log_nav_data(svid, ADKD4, word_type)
self.adkd4_data_managers[svid].add_word(word_type, page, gst_page)

def _calculate_TTFAF(self, auth_data: AuthenticatedData, gst_subframe: GST):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "https://osnmalib.eu/status_log.schema.json",
"title": "OSNMAlib Status Log",
"description": "Format of the JSON status log generated by OSNMAlib",
"description": "Format of the JSON status log generated by OSNMAlib.",

"type": "array",
"items": {
Expand Down Expand Up @@ -274,7 +274,12 @@
"patternProperties": {
"^[0-9]+$": {
"type": "object",
"additionalProperties": false,
"properties": {
"IOD": {
"description": "Issue Of Data value of this subframe. It can be extracted from Word Type 1, 2, 3, or 4. If none of those is received, it is null.",
"type": ["null", "string"]
},
"ADKD0": {
"description": "Words types for ADKD0 or ADKD12. True if received, False if not.",
"type": "object",
Expand Down
6 changes: 5 additions & 1 deletion osnma/utils/status_logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,12 @@ def log_auth_pkr(self, dsm_pkr: 'DSMPKR'):
}
self.verified_osnma_material["last_pkr"] = dsm_pkr_dict

def log_nav_data(self, svid: int, adkd, word_type):
def log_nav_data(self, svid: int, adkd: int, word_type: int):
self.nav_data_received[svid][ADKD(adkd).name][word_type] = True

def log_nav_data_iod(self, svid: int, iod: 'BitArray'):
self.nav_data_received[svid]['IOD'] = iod.bin

def log_mack_data(self, svid, tag_list: List['TagAndInfo'], tesla_key: 'TESLAKey'):
osnma_mack_data = self.osnma_material_received[svid]['mack_data']
osnma_mack_data["tags"] = tag_list
Expand Down Expand Up @@ -303,6 +306,7 @@ def add_satellite(self, gst_sf: 'GST', satellite: 'Satellite'):
# Initialize nav data
if svid not in self.nav_data_received:
self.nav_data_received[svid] = {
"IOD": None,
"ADKD0": {1: False, 2: False, 3: False, 4: False, 5: False},
"ADKD4": {6: False, 10: False},
}
Expand Down

0 comments on commit 3fd8c50

Please sign in to comment.