#ifndef CDRECORD_H
#define CDRECORD_H

/*
 * @(#)Cdrecord.h
 *
 * This file is part of webCDwriter - Network CD Writing.
 *
 * Copyright (C) 2000-2003 Jörg P. M. Haeger
 *
 * webCDwriter is free software. See CDWserver.cpp for details.
 */

#include <time.h>
#include "Process.h"

/**
 * A cdrecord process.
 *
 * @version 20031208
 * @author Jörg P. M. Haeger
 */
class Cdrecord: public Process {
public:
	enum LineType { none, capacity, progress };

private:
	struct {
		int key, code, qual;
		class String *str;
		int successCounter;
	} results[256];
	int firstError, lastCommand, lastError;
	int key, code, qual;
	int cannotReadTOC, cannotReadSessionOffset;
	int fixating, mayNotFit, mediumNotPresent, trayOpen;
	enum LineType lineType;
	struct CDstate *CDstate;
	int fifoPercent, MBwritten, MBofTrackWritten, MBtotal;
	time_t t0, t1, t2;
	int overburn;
	int fixationSeconds;

public:
	Cdrecord(int writerNo, struct CDstate *CDstate = NULL);
	~Cdrecord();
	int getFifoPercent() { return fifoPercent; }
	const char *getFirstError();
	int getFixationSeconds() { return fixationSeconds; }
	const char *getLastError();
	enum LineType getLineType() { return lineType; }
	void getProgress(int &current, int &total);
	int isBlankDisk();
	int isDriveReady();
	int isInProcessOfBecomingReady();
	int isMediumNotPresent();
	int isTrayClosed();
	bool isTrayOpen();
	const char *readLine(int timeout = 0);
	void setOverburn() { overburn = 1; }
};

#endif
