/* ---------------------------------------------------------------------- */ 
/* TargetMessages.h                                                       */ 
/*                                                                        */ 
/* Copyright (c) 2003, 2005  Edgetech Inc.                                */ 
/*                                                                        */ 
/* 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.              */ 
/*                                                                        */ 
/* This file contains the target message formats.                         */ 
/* ---------------------------------------------------------------------- */ 

#ifndef __TARGET_MESSAGES_H__
#define __TARGET_MESSAGES_H__


/* ---------------------------------------------------------------------- */ 
/* includes                                                               */ 
/* ---------------------------------------------------------------------- */ 

#include "MessageOffsets.h"
#include "sonarType.h"


/* ---------------------------------------------------------------------- */ 
/* defines                                                                */ 
/* ---------------------------------------------------------------------- */ 

#define ORIGINAL_FILENAME_SIZE     (512)
#define REMARKS_SIZE               (128)


/* ---------------------------------------------------------------------- */ 
/* Message Types                                                          */ 
/* ---------------------------------------------------------------------- */ 
/* sonarMessage field indicates the type of data to follow.               */ 
/* ---------------------------------------------------------------------- */ 

typedef enum
{
  /* -------------------------------------------------------------------- */ 
  /* Target commands                                                      */ 
  /* -------------------------------------------------------------------- */ 

  /* No message defined yet (No Data)                                     */ 
  TARGET_MESSAGE_NONE = MESSAGE_OFFSET_TARGET,           

  /* signal start of target data (TargetDataType)                         */ 
  TARGET_MESSAGE_START, 

  /* signal end of target data (SonarMessageLongType)                     */ 
  TARGET_MESSAGE_END, 

  /* target information (TargetInfoType)                                  */ 
  TARGET_MESSAGE_INFO,

  /* load existing target (TargetInfoType)                                */ 
  TARGET_MESSAGE_LOAD,

} TargetMessageType;


/* ---------------------------------------------------------------------- */ 
/* Message Data Structures                                                */ 
/* ---------------------------------------------------------------------- */ 
/* The data component of the messages varies with the Target Message as   */      
/* defined by the structures below.                                       */ 
/* ---------------------------------------------------------------------- */ 

/* ---------------------------------------------------------------------- */ 
/* NavOffsetType definition                                               */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  /* X Offset in meters                                                   */ 
  float    XOffset;

  /* Y Offset in meters                                                   */ 
  float    YOffset;

  /* Latitude Offset in degrees                                           */ 
  float    LatOffset;

  /* Longitude Offset in degrees                                          */ 
  float    LonOffset;

  /* Depth Offset in meters up is negative                                */ 
  float    DepthOffset;

  /* Heading Offset in degrees                                            */ 
  float    HeadingOffset;

  /* Pitch Offset in degrees  Nose up is positive                         */ 
  float    PitchOffset;

  /* Roll Offset in degrees   Port side up is positive                    */ 
  float    RollOffset;

  /* Aft Offset in meters                                                 */ 
  float    AftOffset;

  /* Starboard Offset in meters                                           */ 
  float    StarboardOffset;

}  NavOffsetType;


/* ---------------------------------------------------------------------- */ 
/* PaletteXferType definition                                             */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  unsigned char rgbValues[3][256];
}  PaletteXferType;


/* ---------------------------------------------------------------------- */ 
/* Structure for TARGET_START                                             */ 
/* ---------------------------------------------------------------------- */ 

typedef struct
{
  /* size of the target window in returns                                 */ 
  int                size;

  /* sonar return under mouse                                             */ 
  int                centerPing;

  /* sonar sample under mouse                                             */ 
  int                centerReturn;

  /* zoom factor in use                                                   */ 
  int                zoom;

  /* speed of sound in water                                              */ 
  int                waterSoundSpeed;

  /* meters per pixel in window                                           */ 
  double             groundSpacing;

  /* type of sonar being used - alleviate bad 560A timestamps             */ 
  SonarTypeType      sonarType;

  /* reserved for future use                                              */ 
  int                reserved[8];

  /* navigation offsets                                                   */ 
  NavOffsetType      navOffsets;

  /* send the palette info over                                           */ 
  PaletteXferType    paletteInfo;

  /* original file name information                                       */ 
  char               originalFileName[ORIGINAL_FILENAME_SIZE];

}  TargetDataType;


/* ---------------------------------------------------------------------- */ 

typedef struct
{
  /* target ID components                                                 */ 
  int                      sequenceNumber;
  int                      targetNumber;
  int                      revNumber;

  /* explicity reserve space lost to alignment anyway                     */ 
  int                      reserved1;

  /* position of target center                                            */ 

  /* longitude or X in mm or 10000 * (Minutes of Arc) or decimeters       */ 
  double                   lon_X;

  /* latitude or Y in mm or 10000 * (Minutes of Arc) or decimeters        */ 
  double                   lat_Y;

  /* Units of coordinates -                                               */ 
  /* 1 - length (x / y) in millimeters,                                   */ 
  /* 2 - 10000 * (Minutes of Arc)                                         */ 
  /* 3 - length (x / y) in decimeters                                     */ 
  short int                coordUnits;    

  /* for future use and make sure the strcture lies on a quadword boundary*/ 
  short int                reserved2[3];

  /* operators text input                                                 */ 
  char                     remarks[REMARKS_SIZE];

  /* name of target file                                                  */ 
  char                     fileName[ORIGINAL_FILENAME_SIZE];

}  TargetInfoType;


/* ---------------------------------------------------------------------- */ 

#endif  /* Not __TARGET_MESSAGES_H__ */ 


/* ---------------------------------------------------------------------- */ 
/*                       end TargetMessages.h                             */ 
/* ---------------------------------------------------------------------- */ 

