summaryrefslogtreecommitdiff
path: root/service.h
blob: 1248af59c4df2a2d3c314caee45156c2eb1ff42e (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/**
 *  GraphLCD plugin for the Video Disk Recorder
 *
 *  service.h  -  class for events from external services
 *
 *  (c)      2010 Wolfgang Astleitner <mrwastl AT users sourceforge net>
 **/

#ifndef _GRAPHLCD_SERVICE_H_
#define _GRAPHLCD_SERVICE_H_

#include <glcdskin/type.h>

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

#include <vector> // req. for state.h
#include "state.h"

// Radiotext
struct RadioTextService_v1_0 {
  int rds_info;
  int rds_pty;
  char *rds_text;
  char *rds_title;
  char *rds_artist;
  struct tm *title_start;
};

// LcrData
struct LcrService_v1_0 {
  cString destination;
  cString price;
  cString pulse;
};

// Femon
struct FemonService_v1_0 {
  cString  fe_name;
  cString  fe_status;
  uint16_t fe_snr;
  uint16_t fe_signal;
  uint32_t fe_ber;
  uint32_t fe_unc;
  double video_bitrate;
  double audio_bitrate;
  double dolby_bitrate;
};



class cGraphLCDService
{
private:
    //cMutex mutex;
    cGraphLCDState * mState;

    RadioTextService_v1_0  checkRTSData,   currRTSData;
    LcrService_v1_0        checkLcrData,   currLcrData;
    FemonService_v1_0      checkFemonData, currFemonData;
    /*  __Changed = data has been changed */
    /*  __Active  = plugin/service is available and active */
    /*  __Use     = service is requested in skin (don't call services that wouldn't be used anyway) */
    bool                   radioChanged, radioActive,  radioUse;
    bool                   lcrChanged,   lcrActive,    lcrUse;
    bool                   femonChanged, femonActive,  femonUse;
    // timestamp of last service update request
    uint64_t               radioLastChange, lcrLastChange, femonLastChange;
    // min. delay between two service update requests
    int                    radioUpdateDelay, lcrUpdateDelay, femonUpdateDelay;

    // check if femon version <= 1.7.7
    bool                   femonVersionChecked, femonVersionValid;

//protected:

public:
    cGraphLCDService(cGraphLCDState * state);
    virtual ~cGraphLCDService();

    bool ServiceIsAvailable(const std::string & Name);
    void SetServiceUpdateDelay(const std::string & Name, int delay);
    bool NeedsUpdate(uint64_t CurrentTime);
    GLCD::cType GetItem(const std::string & ServiceName, const std::string & Item);
};

#endif