/* ---------------------------------------------------------------------- */ 
/* XstarSegyDefs.h                                                        */ 
/* ---------------------------------------------------------------------- */ 
/*                                                                        */ 
/* (c) Copyright 1999, 2005  EdgeTech,                                    */ 
/*                                                                        */ 
/* This file contains proprietary information, and trade secrets of       */ 
/* EdgeTech, and may not be disclosed or reproduced without the prior     */ 
/* written consent of EdgeTech.                                           */ 
/*                                                                        */ 
/* EdgeTech is not responsible for the consequences of the use or misuse  */ 
/* of this software, even if they result from defects in it.              */ 
/*                                                                        */ 
/* ---------------------------------------------------------------------- */ 
/*                                                                        */ 
/* EdgeTech X-star Rev 5 Hull mount SEG-Y subbottom data format           */ 
/* description.                                                           */ 
/*                                                                        */ 
/* ---------------------------------------------------------------------- */ 

#ifndef __XSTAR_SEGYDEFS_5_0_H__
#define __XSTAR_SEGYDEFS_5_0_H__


/* ---------------------------------------------------------------------- */ 
/* Defines                                                                */ 
/* ---------------------------------------------------------------------- */ 

#define XSTAR_DATA_SIZE                 (3976)
#define XSTAR_ANNOTATION_SIZE             (24)
#define XSTAR_VERSION_SIZE                 (6)
#define XSTAR_RS232_SIZE                  (32)


/* ---------------------------------------------------------------------- */ 
/* Each record of data has a 240 byte header, the content of which is     */ 
/* defined below.                                                         */ 
/*                                                                        */ 
/* Unused fields should be set to 0                                       */ 
/* ---------------------------------------------------------------------- */ 

typedef struct 
{
  /* 0-3 : Trace Sequence Number - ping #                                 */ 
  unsigned long int pingNum;        
  
  /* 4-7 : Starting depth (window offset) in samples.                     */ 
  unsigned long int startDepth;    

  /* 8-11                                                                 */ 
  short int unused0[2];    

  /* 12-15 : Channel Number (1 .. n)                                      */ 
  unsigned long int channelNum;     

  /* 16-21                                                                */ 
  short int unused1[3];

  /* 22-23 number of data packets in sonar trace                          */ 
  short int numberOfPackets;

  /* 24-25 current data packets                                           */ 
  short int currentPacket;

  /* 26-27                                                                */ 
  short int unused1A;

  /* 28-29 : ID Code (always 1 => seismic data)                           */ 
  short int traceIDCode;   

  /* 30-33                                                                */ 
  short int unused2[2];    

  /* 34-35 : DataFormatType                                               */ 
  /*   1 = 2 shorts per sample, stored as real(1), imag(1),               */ 
  /*   2 = Envelope data in gray scale format                             */ 
  short int dataFormat;    

  /* 36-37 : Distance from towfish to antannae in cm                      */ 
  short int NMEAantennaeR; 

  /* 38-39 : Dist to antannae starboard direction in cm                   */ 
  short int NMEAantannaeO; 
  
  /* 40-71 : Reserved for RS232 data                                      */ 
  char RS232[XSTAR_RS232_SIZE];          


  /* -------------------------------------------------------------------- */ 
  /* Navigation data :                                                    */ 
  /* If the coorUnits are seconds(2), the x values represent longitude    */ 
  /* and the y values represent latitude.  A positive value designates    */ 
  /* the number of seconds east of Greenwich Meridian or north of the     */ 
  /* equator.                                                             */ 
  /* -------------------------------------------------------------------- */ 

  /* 72-75 : Meters or Seconds of Arc                                     */ 
  long int sourceCoordX;   

  /* 76-79 : Meters or Seconds of Arc                                     */ 
  long int sourceCoordY;   

  /* 80-83 : mm or 10000 * (Minutes of Arc)                               */ 
  long int groupCoordX;    

  /* 84-87 : mm or 10000 * (Minutes of Arc)                               */ 
  long int groupCoordY;    

  /* 88-89 : Units of coordinates - 1->length (x /y), 2->seconds of arc   */ 
  short int coordUnits;    

  /* 90-91 : Manufacturer Pulse Power Setting                             */ 
  short int mfgPulsePower;    

  /* 92-93 : Pulse Power Setting                                          */ 
  short int pulsePower;    

  /* 94-97                                                                */ 
  short int unused3[2];    

  /* 98-99 : Heave compensation offset (samples)                          */ 
  short int heaveCompensation;    

  /* 100-105                                                              */ 
  short int unused4[3];    

  /* 106-107 : Channel B delay offset (samples)      X_star_2chan only    */ 
  short int channelBDelay;    

  /* 108-109 : Delay between xmit & sampling start (ms)                   */ 
  short int sampleStartDelay;    

  /* 110-111 : Video Delay (ms)                                           */ 
  short int videoDelay;    

  /* 112-113                                                              */ 
  short int unused5;    

  /* 114-115 : Number of Samples, actually # of shorts, 3976 + 120 = 4096 */ 
  unsigned short int samples;       
  
  /* 116-117 : Sample interval in us of stored data                       */ 
  unsigned short int sampleInterval;

  /* 118-119                                                              */ 
  short int unused6;    

  /* 120-121 : Gain factor of ADC                                         */ 
  unsigned short int ADCGain;       

  /* 122-123                                                              */ 
  short int unused7;    

  /* 124-125 : Correlated, 1 - No, 2 - Yes                                */ 
  short int correlated;    

  /* 126-127 : Starting frequency in Hz                                   */ 
  unsigned short int startFreq;     

  /* 128-129 : Ending frequency in Hz                                     */ 
  unsigned short int endFreq;       

  /* 130-131 : Sweep length in ms                                         */ 
  unsigned short int sweepLength;   

  /* 132-133 : Sweep type 1 - Lin, 2 - Par, 3 - Exp, 4 - other            */ 
  unsigned short int sweepType;    

  /* 134-137                                                              */ 
  short int unused8[2];    

  /* 138-139 : Taper type 1 - Lin, 2 - cos sqr, 3 - other                 */ 
  unsigned short int taperType;    

  /* 140-141 : alias Frequency (sample frequency / 2)                     */ 
  short int aliasFreq;     

  /* 142-143                                                              */ 
  short int unused9;    

  /* 144-151                                                              */ 
  short int unused9a[4];    

  /* 152-155 : millisecond tick counter                                   */ 
  long millisecondCounter;    

  /* 156-157 : Year data recorded (CPU time)                              */ 
  short int year;          

  /* 158-159 :                                                            */ 
  short int day;           

  /* 160-161 :                                                            */ 
  short int hour;          

  /* 162-163 :                                                            */ 
  short int minute;        

  /* 164-165 :                                                            */ 
  short int second;        

  /* 166-167 : Always 3 (other not specified by standard)                 */ 
  short int timeBasis;     

  /* 168-169                                                              */ 
  short int unused10;    

  /* 170-171 : Maximum channel B absolute value ADC   X_star_2chan only   */ 
  unsigned short int ChannelBADCMax;        


  /* -------------------------------------------------------------------- */ 
  /* From pitch/roll/temp/heading sensor                                  */ 
  /* -------------------------------------------------------------------- */ 

  /* 172-173 : Compass heading                                            */ 
  short int heading;       

  /* 174-175 : Pitch                                                      */ 
  short int pitch;         

  /* 176-177 : Roll                                                       */ 
  short int roll;          

  /* 178-179 : Temperature                                                */ 
  short int temperature;   


  /* -------------------------------------------------------------------- */ 
  /* User defined area from 180-239                                       */ 
  /* -------------------------------------------------------------------- */ 

  /* 180-181 : (# of 0s in trace in X-Star)                               */ 
  short int numZeros;      

  /* 182-183 : TriggerSource (0 = internal, 1 = external)                 */ 
  short int trigSource;    

  /* 184-185 : Mark Number (0 = no mark)                                  */ 
  unsigned short int markNumber;    

  /* 186-187                                                              */ 
  short int NMEAHour;

  /* 188-189                                                              */ 
  short int NMEAMinutes;

  /* 190-191                                                              */ 
  short int NMEASeconds;

  /* 192-193                                                              */ 
  short int NMEACourse;

  /* 194-195                                                              */ 
  short int NMEASpeed;

  /* 196-197                                                              */ 
  short int NMEADay;

  /* 198-199                                                              */ 
  short int NMEAYear;

  /* 200-203 : Trace scale factor                                         */ 
  float traceScaleFactor;

  /* 204-205 : Maximum absolute value for ADC samples for this packet     */ 
  unsigned short int ADCMax;        

  /* 206-207 System constant in tenths of a dB                            */ 
  short int calConst;      

  /* 208-209 Vehicle ID                                                   */ 
  short int vehicleID;     

  /* 210-215 Software version number                                      */ 
  char softwareVersion[XSTAR_VERSION_SIZE]; 

  /* 216-239 : Annotation string                                           */ 
  char annotation[XSTAR_ANNOTATION_SIZE];


  /* -------------------------------------------------------------------- */ 
  /* Data area begins here                                                */ 
  /* -------------------------------------------------------------------- */ 
  /* Data begins at byte 240, has 3976 shorts in it                       */ 
  /* -------------------------------------------------------------------- */ 
  short int data[XSTAR_DATA_SIZE];

} XstarSegyData50Type;


/* ---------------------------------------------------------------------- */ 

#endif  /* end Not __XSTAR_SEGYDEFS_5_0_H__ */ 

/* ---------------------------------------------------------------------- */ 
/*                        end XstarSegyDefs.h                             */ 
/* ---------------------------------------------------------------------- */ 

