File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -437,6 +437,9 @@ class ReassembleIDASBDlibACARS(ReassembleIDASBD):
437
437
def __init__ (self ):
438
438
global libacars , la_msg_dir
439
439
from libacars import libacars , la_msg_dir
440
+ if 'json' in config .args :
441
+ global json
442
+ import json
440
443
super ().__init__ ()
441
444
442
445
def consume_l2 (self , q ):
@@ -459,11 +462,21 @@ def consume_l2(self, q):
459
462
if o .is_ping () and 'nopings' in config .args :
460
463
return
461
464
465
+ q .timestamp = dt .epoch (q .time ).isoformat (timespec = 'seconds' )
466
+
462
467
if 'json' in config .args :
463
- print (o .json ())
468
+ out = {}
469
+
470
+ out ['app' ] = { 'name' : 'iridium-toolkit' , 'version' : '0.0.2' }
471
+ out ['source' ] = { 'transport' : 'iridium' , 'parser' : 'libacars' , 'version' : libacars .version }
472
+ out ['timestamp' ] = q .timestamp
473
+ out ['link_direction' ] = 'uplink' if q .ul else 'downlink'
474
+ if config .station :
475
+ out ['source' ]['station_id' ] = config .station
476
+ out ['acars' ]= json .loads (o .json ())['acars' ]
477
+ print (json .dumps (out ), file = outfile )
464
478
return
465
479
466
- q .timestamp = dt .epoch (q .time ).isoformat (timespec = 'seconds' )
467
480
print (q .timestamp , end = " " )
468
481
469
482
if q .ul :
You can’t perform that action at this time.
0 commit comments