/****************************************************************************/
/* Copyright (c) 2012 MBARI                                                 */
/* MBARI Proprietary Information. All rights reserved.                      */
/****************************************************************************/
/* Summary  :                                                               */
/* Filename : KiProLog.cc                                               */
/* Author   :                                                               */
/* Project  :                                                               */
/* Version  : 1.0                                                           */
/* Created  : 12/07/2014                                                    */
/* Modified :                                                               */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/****************************************************************************/
#include "DataLogWriter.h"
#include "KiProLog.h"
#include "KiPro.h"
#include "ShortData.h"
#include "TimeP.h"
#include "Syslog.h"

KiProLog::KiProLog(KiPro *k,
           DataLog::FileFormat fileFormat,
           const char* name)
   : _kipro(k),
     DataLogWriter(name, fileFormat, AutoTimeStamp)
{
  init();
}


void KiProLog::init(void)
{
  char dname[100];
  sprintf(dname, "%s.data", name());
  setMnemonic(dname);

  // Indicates that the KiPro board initialized and ready

  // KiPro state
  //
  sprintf(dname, "%s.mode", name());
  addField((_mode = new IntegerData(dname)));

  sprintf(dname, "%s.timecode", name());
  addField((_timecode = new DoubleData(dname)));

  sprintf(dname, "%s.recording", name());
  addField((_recording = new IntegerData(dname)));

  sprintf(dname, "%s.available_media", name());
  addField((_available_media = new IntegerData(dname)));

}


KiProLog::~KiProLog()
{
}


void KiProLog::setFields()
{
   Boolean debug = False;


   if( _kipro )
   {
      _mode->setValue(_kipro->_mode);
      _timecode->setValue(_kipro->_timecode);
      _recording->setValue(_kipro->_recording);
      _available_media->setValue(_kipro->_available_media);
   }
}
