diff options
-rw-r--r-- | vrt/lib/expanded_header.cc | 46 | ||||
-rw-r--r-- | vrt/lib/expanded_if_context_section.cc | 59 | ||||
-rw-r--r-- | vrt/lib/header_utils.cc | 17 | ||||
-rw-r--r-- | vrt/lib/header_utils.h | 5 |
4 files changed, 80 insertions, 47 deletions
diff --git a/vrt/lib/expanded_header.cc b/vrt/lib/expanded_header.cc index 06056551e..bc6a6190c 100644 --- a/vrt/lib/expanded_header.cc +++ b/vrt/lib/expanded_header.cc @@ -154,14 +154,44 @@ namespace vrt { return "<unknown pkt type>"; } - static void wr_name(std::ostream &os, const std::string &x) - { - os << format(" %-19s ") % (x + ":"); - } - - static void wr_uint32(std::ostream &os, uint32_t x) + static void wr_header(std::ostream &os, uint32_t x) { os << format("%#10x") % x; + + uint32_t t = (x >> 22) & 0x3; + switch(t){ + case 0x0: os << " TSI=NONE"; break; + case 0x1: os << " TSI=UTC"; break; + case 0x2: os << " TSI=GPS"; break; + case 0x3: os << " TSI=OTHER"; break; + } + + t = (x >> 20) & 0x3; + switch(t){ + case 0x0: os << " TSF=NONE"; break; + case 0x1: os << " TSF=SAMPLE_CNT";break; + case 0x2: os << " TSI=PICOSECS"; break; + case 0x3: os << " TSI=FREE_RUN"; break; + } + + uint32_t pt = x & VRTH_PT_MASK; + if (pt == VRTH_PT_IF_CONTEXT || pt == VRTH_PT_EXT_CONTEXT){ + if (x & VRTH_TSM) + os << " TSM=GENERAL"; + else + os << " TSM=EXACT"; + } + else if (0 + || pt == VRTH_PT_IF_DATA_WITH_SID + || pt == VRTH_PT_IF_DATA_NO_SID + || pt == VRTH_PT_EXT_DATA_WITH_SID + || pt == VRTH_PT_EXT_DATA_NO_SID){ + if (x & VRTH_START_OF_BURST) + os << " SOB"; + if (x & VRTH_END_OF_BURST) + os << " EOB"; + } + os << std::endl; } @@ -171,12 +201,12 @@ namespace vrt { port << format("%s:\n") % pkt_type_name(this); if (1){ wr_name(port, "header"); - wr_uint32(port, header); + wr_header(port, header); } if (stream_id_p()){ wr_name(port, "stream_id"); - wr_uint32(port, stream_id); + wr_uint32_hex(port, stream_id); } if (class_id_p()){ diff --git a/vrt/lib/expanded_if_context_section.cc b/vrt/lib/expanded_if_context_section.cc index 80232a807..ec75d9f4e 100644 --- a/vrt/lib/expanded_if_context_section.cc +++ b/vrt/lib/expanded_if_context_section.cc @@ -331,23 +331,6 @@ namespace vrt return u.consumed_all(); } - static void wr_name(std::ostream &os, const std::string &x) - { - os << format(" %-19s ") % (x + ":"); - } - - static void wr_uint32_hex(std::ostream &os, uint32_t x) - { - os << format("%#10x") % x; - os << std::endl; - } - - static void wr_uint32_dec(std::ostream &os, uint32_t x) - { - os << format("%12d") % x; - os << std::endl; - } - static void wr_hertz(std::ostream &os, vrt_hertz_t x) { os << format("%12g Hz") % vrt_hertz_to_double(x); @@ -375,7 +358,7 @@ namespace vrt static void wr_angle(std::ostream &os, vrt_angle_t x) { if (x == VRT_GPS_UNKNOWN_VALUE) - os << "UNKNOWN"; + os << " UNKNOWN"; else os << format("%10g deg") % vrt_angle_to_double(x); @@ -385,7 +368,7 @@ namespace vrt static void wr_distance(std::ostream &os, vrt_distance_t x) { if (x == VRT_GPS_UNKNOWN_VALUE) - os << "UNKNOWN"; + os << " UNKNOWN"; else os << format("%10g m") % vrt_distance_to_double(x); @@ -395,7 +378,7 @@ namespace vrt static void wr_velocity(std::ostream &os, vrt_velocity_t x) { if (x == VRT_GPS_UNKNOWN_VALUE) - os << "UNKNOWN"; + os << " UNKNOWN"; else os << format("%10g m/s") % vrt_velocity_to_double(x); @@ -455,43 +438,43 @@ namespace vrt { uint32_t t = (x.tsi_tsf_manuf_oui >> 26) & 0x3; switch(t){ - case 0x0: os << " TSI_UNDEF"; break; - case 0x1: os << " TSI_UTC"; break; - case 0x2: os << " TSI_GPS"; break; - case 0x3: os << " TSI_OTHER"; break; + case 0x0: os << " TSI=UNDEF"; break; + case 0x1: os << " TSI=UTC"; break; + case 0x2: os << " TSI=GPS"; break; + case 0x3: os << " TSI=OTHER"; break; } t = (x.tsi_tsf_manuf_oui >> 24) & 0x3; switch(t){ - case 0x0: os << " TSF_UNDEF"; break; - case 0x1: os << " TSF_SAMPLE_CNT";break; - case 0x2: os << " TSI_PICOSECS"; break; - case 0x3: os << " TSI_FREE_RUN"; break; + case 0x0: os << " TSF=UNDEF"; break; + case 0x1: os << " TSF=SAMPLE_CNT";break; + case 0x2: os << " TSI=PICOSECS"; break; + case 0x3: os << " TSI=FREE_RUN"; break; } t = x.tsi_tsf_manuf_oui & 0x00ffffff; - os << format(" manuf_oui=%#10x") % t; + os << format(" manuf_oui=%#x\n") % t; - wr_name(os, "fix int secs"); + wr_name(os, " fix int secs"); //os << format("%10d\n") % x.integer_secs; wr_int_secs(os, x.integer_secs); - wr_name(os, "fix frac secs"); + wr_name(os, " fix frac secs"); os << format("%10d\n") % get_frac_secs(&x.fractional_secs); - wr_name(os, "latitude"); + wr_name(os, " latitude"); wr_angle(os, x.latitude); - wr_name(os, "longitude"); + wr_name(os, " longitude"); wr_angle(os, x.longitude); - wr_name(os, "altitude"); + wr_name(os, " altitude"); wr_distance(os, x.altitude); - wr_name(os, "speed_over_ground"); + wr_name(os, " speed_over_ground"); wr_velocity(os, x.speed_over_ground); - wr_name(os, "heading_angle"); + wr_name(os, " heading_angle"); wr_angle(os, x.heading_angle); - wr_name(os, "track_angle"); + wr_name(os, " track_angle"); wr_angle(os, x.track_angle); - wr_name(os, "magnetic_variation"); + wr_name(os, " magnetic_variation"); wr_angle(os, x.magnetic_variation); os << std::endl; diff --git a/vrt/lib/header_utils.cc b/vrt/lib/header_utils.cc index 3c97df861..1cd15dedf 100644 --- a/vrt/lib/header_utils.cc +++ b/vrt/lib/header_utils.cc @@ -48,5 +48,22 @@ namespace vrt os << std::endl; } + void wr_name(std::ostream &os, const std::string &x) + { + os << format(" %-21s ") % (x + ":"); + } + + void wr_uint32_hex(std::ostream &os, uint32_t x) + { + os << format("%#10x") % x; + os << std::endl; + } + + void wr_uint32_dec(std::ostream &os, uint32_t x) + { + os << format("%12d") % x; + os << std::endl; + } + }; }; diff --git a/vrt/lib/header_utils.h b/vrt/lib/header_utils.h index 823d37b6b..df087eac8 100644 --- a/vrt/lib/header_utils.h +++ b/vrt/lib/header_utils.h @@ -28,8 +28,11 @@ namespace vrt { namespace detail { + void wr_name(std::ostream &os, const std::string &x); void wr_int_secs(std::ostream &os, uint32_t secs); - + void wr_uint32_hex(std::ostream &os, uint32_t x); + void wr_uint32_dec(std::ostream &os, uint32_t x); + }; }; |