summaryrefslogtreecommitdiff
path: root/ledsconf.h
blob: 3d0ea541e93f56deb52e761a4318b144db905278 (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
62
63
/*
 * ledsconf.h: A plugin for the Video Disk Recorder
 *
 * See the README file for copyright information and how to reach the author.
 *
 * $Id: ledsconf.h,v 1.9 2012/11/20 14:32:28 wendel Exp $
 */

#ifndef _LED_CONF_H_
#define _LED_CONF_H_

#include <vdr/plugin.h>
#include <vdr/tools.h>

#include "seduservice.h"

//***************************************************************************
// cLedConf
//***************************************************************************

class cLedConf : public cListObject, public cSeduService
{
   public:

      cLedConf() {};

      bool Parse(const char* s);

      int X()       { return x; }
      int ToX()     { return toX; }
      int Y()       { return y; }
      int ToY()     { return toY; }
      int Pos()     { return lp; }
      const char* RgbOrder() { return rgbOrder; }

      int isValid() { return x > na && y > na && lp > na; }

   private:

      bool parseRange(const char*& p, int& from, int& to);
      bool parseOrder(const char*& p, char* order);
      const char* skipWs(const char* p);

      int x {na};
      int toX {na};
      int y {na};
      int toY {na};
      int lp {na};                // LED postition
      char rgbOrder[4] {'\0'};
};

//***************************************************************************
// cLedConfs
//***************************************************************************

class cLedConfs : public cConfig<cLedConf>
{

};

extern cLedConfs ledConfs;

#endif // _LED_CONF_H_