#ifndef CDRECORD_H
#define CDRECORD_H

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

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

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

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

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

#endif
