/*
 * channelscan.h: A plugin for the Video Disk Recorder
 *
 * See the README file for copyright information and how to reach the author.
 *
 * $Id$
 */

#ifndef __CHANNELSCAN_H
#define __CHANNELSCAN_H

#include <vdr/plugin.h>
#include <vdr/thread.h>
#include <vector>
#include <string>


#define DBG " --- Channelscan --- debug: "
#define ERR " Channelscan ERROR: "

using std::vector;
using std::string;

static const char *VERSION        = "0.3.0";
static const char *DESCRIPTION    = "Search Transponders for DVB Channels";
static const char *MAINMENUENTRY  = "Channelscan";

extern bool scanning_by_channelscan;
extern int oldUpdateChannels;

extern cMutex mutexNames;
extern vector<string> tvChannelNames;
extern vector<string> radioChannelNames;
extern vector<string> dataChannelNames;

enum eScan {
		idle,
		scanning,
		error,
		aborted,
		success
};

extern volatile eScan ScanStat;

// --- cPluginChannelscan ---------------------------------------------------------

class cPluginChannelscan : public cPlugin {
private:
	// Add any member variables or functions you may need here.
public:
	cPluginChannelscan();
	virtual ~cPluginChannelscan();
	virtual const char *Version(void) { return VERSION; }
	virtual const char *Description(void) { return tr(DESCRIPTION); }
	virtual const char *CommandLineHelp(void);
	virtual bool ProcessArgs(int argc, char *argv[]);
	virtual bool Initialize(void);
	virtual bool Start(void);
	virtual void Housekeeping(void);
	virtual const char *MainMenuEntry(void) { return tr(MAINMENUENTRY); }
	virtual cOsdObject *MainMenuAction(void);
	virtual cMenuSetupPage *SetupMenu(void);
	virtual bool SetupParse(const char *Name, const char *Value);
   virtual bool HasSetupOptions(void) { return false; }
};

// --- cSetupMenu ------------------------------------------------------

class cMenuChannelscanSetup : public cMenuSetupPage
{
private:
	int serviceType;
	const char *serviceTypeTexts[4];
	virtual void Setup(void);
protected:
	virtual eOSState ProcessKey(eKeys Key);
	virtual void Store(void);
public:
	cMenuChannelscanSetup(void);
};

extern int setupServiceType;

#endif // __CHANNELSCAN_H
