/*
 * DisplayController.h
 *
 *  Created on: Aug 7, 2018
 *      Author: Andreas Schneider, Johannes Wendel, Jonas Zeunert
 */

#ifndef _SRC_OUTPUT_DISPLAYCONTROLLER_H_
#define _SRC_OUTPUT_DISPLAYCONTROLLER_H_

#include <vector>
#include <thread>

#include "output/DisplayController.h"
#include "output/items/OutputDisplay.h"
#include "output/DisplayBoardPinController.h"

namespace flippR_driver
{
namespace output
{
namespace detail
{

class DisplayController : public output::DisplayController
{
public:
	explicit DisplayController(std::vector<std::shared_ptr<items::OutputDisplay>> displays, std::unique_ptr<DisplayBoardPinController> pin_controller);
	~DisplayController() override;

	void activate_displays() const override;
	void deactivate_displays() const override;

private:
	void cycle_displays() const;

private:
	const std::vector<std::shared_ptr<items::OutputDisplay>> displays;

	const std::shared_ptr<DisplayBoardPinController> pin_controller;

	std::thread display_cycle_thread;
	bool is_running;
};

}
}
}
#endif
