#include <common.h>
#include "tran_nbp.h"

void print_header(h)
NBP_HEADER_TYPE *h;
{
   int i;

   printf("\n HEADER:\n");
   printf("   nbytes in data segment = %d\n", h->n_bytes_in_data_segment);
   printf("   n depth cells = %d\n", h->n_depth_cells);
   printf("   n data types = %d\n   offsets: ", h->n_data_types);
   for  (i = 0; i < h->n_data_types; i++)
      printf(" %02x", h->offset[i]);
   printf("\n");
}

void print_configuration(c)
NBP_CONFIGURATION_TYPE *c;
{
   printf("\n CONFIGURATION:\n");
   printf("   adcp_type = %s\n", (c->adcp_type == 0 ? "narrowband" : "broadband"));
   printf("   transect_version = %u.%u\n", c->transect_version, c->transect_revision);
   printf("   ADCP_serial_number = %hu\n", c->ADCP_serial_number);
   printf("   ADCP_firmware_number = %5.2f\n", c->ADCP_firmware_number/100.0);
   printf("   number_of_beams = %d; beam_angle = %d\n", c->n_beams, c->beam_angle);
   printf("   frequency = %hu; range_switch = %s\n", c->frequency, (c->range_switch == 0 ? "low" : "high"));
   printf("   coord_system = %s\n", (c->coord_system == 0 ? "beam" : "earth"));
   printf("   orientation = %s\n", (c->orientation == 0 ? "up" : "down"));
   printf("   beam_pattern = %s\n", (c->beam_pattern == 0 ? "convex" : "concave"));
   printf("   number_of_bins = %d\n", c->n_bins);
   printf("   time_between_pings = %lu; pings_per_ensemble = %hu\n", c->ping_interval, c->pings_per_ens);
   printf("   bin_length = %d; pulse_length = %hu; blank_after_transmit = %hu; adcp_depth = %lu\n", 
              c->bin_length, c->pulse_length, c->blank, c->adcp_depth);
   printf("   avg_method = %s; avg_interval = %lu\n", (c->avg_method == 0 ? "temporal" : "spatial"), c->avg_interval);
   /* etc etc */
   printf("   deployment name (%d chars) = %s\n", c->dply_name_size, c->name);
   printf("   direct commands = %d:\n", c->direct_cmd_size);
   printf("%s\n", c->direct_cmd);
}

void print_leader(l)
NBP_LEADER_TYPE *l;
{
   printf("\n LEADER:\n");
   printf("   ensemble # = %hu; time = %ld\n", l->ens_number, l->ens_start_seconds);
   printf("   average pitch = %hd roll = %hd heading = %hu\n", l->avg_pitch, l->avg_roll, l->avg_heading);
   printf("   average temperature = %hd\n", l->avg_temperature);
   printf("   elapsed time = %lu\n", l->elapsed_time);
}

void print_nav(n)
TRANSECT_NAV_TYPE *n;
{
   printf("\n NAVIGATION:\n");
   printf("   latitude = %ld longitude = %ld\n", n->lat, n->lon);
   printf("   ship u = %hd v = %hd\n", n->u, n->v);
}
