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

#include "zaphistory.h"
#include "config.h"
#include "setup.h"
#include "zaphistoryosd.h"

cPluginZaphistory::cPluginZaphistory(void)
{
  // Initialize any member variables here.
  // DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL
  // VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT!
  config.maxEntries=10;
  zappedChannels=(int*)malloc(sizeof(int)*config.maxEntries);
  for (int i=0;i<config.maxEntries;i++)
  	zappedChannels[i]=0;
  channelMonitor=new cChannelMonitor;
}

cPluginZaphistory::~cPluginZaphistory()
{
  // Clean up after yourself!
  delete channelMonitor;
  free(zappedChannels);
}

const char *cPluginZaphistory::CommandLineHelp(void)
{
  // Return a string that describes all known command line options.
  return NULL;
}

bool cPluginZaphistory::ProcessArgs(int argc, char *argv[])
{
  // Implement command line argument processing here if applicable.
  return true;
}

bool cPluginZaphistory::Initialize(void)
{
  // Initialize any background activities the plugin shall perform.
  return true;
}

bool cPluginZaphistory::Start(void)
{
  // Start any background activities the plugin shall perform.
  return true;
}

void cPluginZaphistory::Stop(void)
{
  // Stop any background activities the plugin shall perform.
}

void cPluginZaphistory::Housekeeping(void)
{
  // Perform any cleanup or other regular tasks.
}

cOsdObject *cPluginZaphistory::MainMenuAction(void)
{
  // Perform the action when selected from the main VDR menu.
  return new cMenuZappedChannels;
}

cMenuSetupPage *cPluginZaphistory::SetupMenu(void)
{
  // Return a setup menu in case the plugin supports one.
  return new cZapHistorySetup;
}

bool cPluginZaphistory::SetupParse(const char *Name, const char *Value)
{
  // Parse your own setup parameters and store their values.
  // Parse your own setup parameters and store their values.
  if      (!strcasecmp(Name, "MaxEntries"))                 config.maxEntries = atoi(Value);
  else return false;
  return true;
}

sZapHistoryConfig config;
int *zappedChannels;

VDRPLUGINCREATOR(cPluginZaphistory); // Don't touch this!
