summaryrefslogtreecommitdiff
path: root/service.c
blob: 1c34f983e7f5a81a7e5020dcac40d20423a78cc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
 * service.c: EPG2VDR plugin for the Video Disk Recorder
 *
 * See the README file for copyright information and how to reach the author.
 *
 */

#include "service.h"
#include "plgconfig.h"

//***************************************************************************
// Class cEpgTimer
//***************************************************************************

cEpgTimer::cEpgTimer(bool Instant, bool Pause, const cChannel* Channel)
   : cEpgTimer_Interface_V1(Instant, Pause, Channel)
{
   timerid = na; eventid = na;
   vdrName = 0; vdrUuid = 0;
   vdrRunning = no;
   stateInfo = 0;
   local = yes;
}

cEpgTimer::~cEpgTimer()
{
   free(vdrUuid);
   free(vdrName);
   free(stateInfo);
}

void cEpgTimer::setState(char s, const char* info)
{
   state = s;
   free(stateInfo);
   stateInfo = 0;

   if (!isEmpty(info))
      stateInfo = strdup(info);
}

void cEpgTimer::setAction(char a)
{
   action = a;
}

void cEpgTimer::setVdr(const char* name, const char* uuid, int running)
{
   local = yes;   // the default
   free(vdrUuid);
   free(vdrName);
   vdrName = strdup(name);

   if (!isEmpty(uuid))
      vdrUuid = strdup(uuid);

   vdrRunning = running;

   if (!isEmpty(vdrUuid) && strcmp(vdrUuid, Epg2VdrConfig.uuid) != 0)
      local = no;
}