/****************************************************************************/
/* Copyright (c) 2012 MBARI                                                 */
/* MBARI Proprietary Information. All rights reserved.                      */
/****************************************************************************/
/* Summary  :                                                               */
/* Filename : CathxM12Log.cc                                                */
/* Author   :                                                               */
/* Project  :                                                               */
/* Version  : 1.0                                                           */
/* Created  : 09/17/2015                                                    */
/* Modified :                                                               */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/****************************************************************************/
#include "DataLogWriter.h"
#include "CathxM12Log.h"
#include "CathxM12Output.h"
#include "CathxM12.h"
#include "ShortData.h"
#include "TimeP.h"
#include "Syslog.h"

CathxM12Log::CathxM12Log(CathxM12 *c,
           DataLog::FileFormat fileFormat,
           const char* name)
   : _cathxM12(c),
     DataLogWriter(name, fileFormat, AutoTimeStamp)
{
  init();
}


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

  // Indicates that the CathxM12 board initialized and ready

  // CathxM12 state
  //
  sprintf(dname, "%s.req_capture", name());
  addField((_req_capture = new IntegerData(dname)));

  sprintf(dname, "%s.act_capture", name());
  addField((_act_capture = new IntegerData(dname)));

  sprintf(dname, "%s.req_capture", name());
  addField((_req_profile = new IntegerData(dname)));

  sprintf(dname, "%s.act_profile", name());
  addField((_act_profile = new IntegerData(dname)));

}


CathxM12Log::~CathxM12Log()
{
}


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


   if( _cathxM12 )
   {
      _req_capture->setValue(_cathxM12->_output->data.req_capture);
      _act_capture->setValue(_cathxM12->_output->data.act_capture);
      _req_profile->setValue(_cathxM12->_output->data.req_profile);
      _act_profile->setValue(_cathxM12->_output->data.act_profile);
   }
}
