#ifndef INCLUDED_LogTestMachine_h_
#define INCLUDED_LogTestMachine_h_
 
#include "Behaviors/StateMachine.h"
#include "Behaviors/Controls/EventLogger.h"
#include "Shared/ProjectInterface.h"
#include "Sound/SoundManager.h"
#include "Vision/JPEGGenerator.h"

class Message : public StateNode {
public:
  Message(std::string const &name) : StateNode("Message",name) {}
  virtual void DoStart() {
    std::string const msg = "Hooray for Captain Spaulding!";
    EventLogger::logMessage(msg,this);
  }
};

class Image : public StateNode {
public:
  Image(std::string const &name) : StateNode("Image",name) {}
  virtual void DoStart() {
    EventLogger::logImage(*ProjectInterface::defColorJPEGGenerator,ProjectInterface::fullLayer,0,this);
    sndman->playFile("camera.wav");
  }
};

class Webcam : public StateNode {
public:
  Webcam(std::string const &name) : StateNode("Webcam",name) {}
  virtual void DoStart() {
    EventLogger::logWebcam(this);
  }
};

class LogTestMachine : public StateNode {
public:
  LogTestMachine() : StateNode("LogTestMachine") {}

  virtual void setup() {
#statemachine
  waiting: StateNode

  waiting >== TextMsgTrans($$,"message")==> Message =N=> waiting

  waiting >== TextMsgTrans($$,"image")==> Image =N=> waiting

  waiting >== TextMsgTrans($$,"webcam")==> Webcam =N=> waiting
#endstatemachine

    startnode = waiting;
}

protected:  // Dummy functions to satisfy the compiler
  LogTestMachine(const LogTestMachine&);
  LogTestMachine& operator=(const LogTestMachine&);

};

#endif
