/* LICENSE:
  =========================================================================
    CMPack'04 Source Code Release for OPEN-R SDK 1.1.5-r2 for ERS7
    Copyright (C) 2004 Multirobot Lab [Project Head: Manuela Veloso]
    School of Computer Science, Carnegie Mellon University
    All rights reserved.
  ========================================================================= */

#ifndef INCLUDED_DataInterface
#define INCLUDED_DataInterface

class LogReader;
class RobotDataPacket;

class AllRobotViewData;

class BehaviorNamesPacketDecoder;
class BehaviorTracePacketDecoder;
class LocalizationPacketDecoder;
class MotionPacketDecoder;
class RadialModelPacketDecoder;
class VisionPacketDecoder;
class VisionRawPacketDecoder;
class VisionRLEPacketDecoder;
class WorldModelPacketDecoder;
class TrackerPacketDecoder;
class WMDebugPacketDecoder;

/*------------------------------------------------------------------
CLASS
  DataInterface

DESCRIPTION
  Provides an interface for the GUI to use to drive the data processing
  parts of the program.
------------------------------------------------------------------*/

class DataInterface {
public:
  DataInterface();

  void setLog(const char *filename);
  void rewindLog();
  void stepLog();
  void stepLogMove();

  void cacheLog(const char * filename);
  void gotoLogPosition(int idx);

  unsigned int logLength();

  bool activeLog();

  bool getWorldViewActive();
  void setWorldViewActive(bool new_state);

  bool getEgoViewActive();
  void setEgoViewActive(bool new_state);
  bool getEVVisRadMapActive();
  void setEVVisRadMapActive(bool new_state);
  bool getEVModRadMapActive();
  void setEVModRadMapActive(bool new_state);

  bool getVisRLEActive();
  void setVisRLEActive(bool new_state);

  void quit();

  unsigned long getPacketTimestamp(int idx=-1);

  // robot view data
  AllRobotViewData *allRobotViewData;

  // decoders
  BehaviorNamesPacketDecoder *behNamesDecoder;
  BehaviorTracePacketDecoder *behTraceDecoder;
  LocalizationPacketDecoder  *locDecoder;
  MotionPacketDecoder        *motDecoder;
  RadialModelPacketDecoder   *radialModelDecoder;
  VisionPacketDecoder        *visDecoder;
  VisionRawPacketDecoder     *visRawDecoder;
  VisionRLEPacketDecoder     *visRLEDecoder;
  WorldModelPacketDecoder    *wmDecoder;  
  TrackerPacketDecoder       *trackerDecoder;  
  WMDebugPacketDecoder       *wmDebugDecoder;

private:
  LogReader *currentLog;

  RobotDataPacket *packet;
  RobotDataPacket *time_packet;

  bool worldViewActive;
  bool egoViewActive;
  bool evVisRadMapActive;
  bool evModRadMapActive;
  bool visRLEActive;

  int log_idx;
};

#endif
