/****************************************************************************/
/* Copyright (c) 2000 MBARI                                                 */
/* MBARI Proprietary Information. All rights reserved.                      */
/****************************************************************************/
/* Summary  :                                                               */
/* Filename : SimulatedCtd.cc                                               */
/* Author   :                                                               */
/* Project  :                                                               */
/* Version  : 1.0                                                           */
/* Created  : 02/07/2000                                                    */
/* Modified :                                                               */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/****************************************************************************/
#include <time.h>
#include "SimulatedCtd.h"
#include "MathP.h"
#include "Syslog.h"

SimulatedCtd::SimulatedCtd()
  : CTDIF_SK()
{
  Boolean debug = True;

  _simulator = new SimulatorIF("simulator");
  dprintf("SimulatedCtd::SimulatedCtd() - triggerEvent()");
  triggerEvent(DeviceIF::Ok);
}


SimulatedCtd::~SimulatedCtd()
{
  delete _simulator;
}


long SimulatedCtd::salinity(double *value, long *t)
{
  *value = 0.0;
  *t = time(0);
  return 0;
}


long SimulatedCtd::conductivity(double *value, long *t)
{
  *value = 0.2;
  *t = time(0);
  return 0;
}


long SimulatedCtd::temperature(float *value, long *t)
{
  *value = 10.8;
  *t = time(0);
  return 0;
}


long SimulatedCtd::depth(double *value, long *t)
{
  Boolean debug = False;

  SimulatorIF::Vector position, eulerAngles;
  SimulatorIF::Vector positionRate, rotationRate;

  _simulator->state(position, positionRate, eulerAngles, rotationRate);

  *value = position[Z];
  dprintf("SimulatedCtd::depth() - value=%.2f\n", *value);

  *t = time(0);
  return 0;
}


long SimulatedCtd::pressure(float *value, long *t)
{
  *value = 100;
  *t = time(0);
  return 0;
}


long SimulatedCtd::speedOfSound(double *value, long *t)
{
  *value = 1010.;
  *t = time(0);
  return 0;
}


long SimulatedCtd::setAtmPressure(float pressure)
{
  return 0;
}


long SimulatedCtd::rawValues(float *conductFreq, float *tempFreq,
			     long *t)
{
  *conductFreq = 10.;
  *tempFreq = 20.;
  *t = time(0);
  return 0;
}


long SimulatedCtd::startPump()
{
  return 0;
}


long SimulatedCtd::stopPump()
{
  return 0;
}


int SimulatedCtd::spawnAuxTasks()
{
  return 0;
}
