vdr  2.2.0
diseqc.h
Go to the documentation of this file.
1 /*
2  * diseqc.h: DiSEqC handling
3  *
4  * See the main source file 'vdr.c' for copyright information and
5  * how to reach the author.
6  *
7  * $Id: diseqc.h 3.1 2013/06/12 11:52:17 kls Exp $
8  */
9 
10 #ifndef __DISEQC_H
11 #define __DISEQC_H
12 
13 #include "config.h"
14 #include "positioner.h"
15 #include "thread.h"
16 
18 private:
19  void SendDiseqc(uint8_t *Codes, int NumCodes);
20 public:
21  cDiseqcPositioner(void);
22  virtual void Drive(ePositionerDirection Direction);
23  virtual void Step(ePositionerDirection Direction, uint Steps = 1);
24  virtual void Halt(void);
25  virtual void SetLimit(ePositionerDirection Direction);
26  virtual void DisableLimits(void);
27  virtual void EnableLimits(void);
28  virtual void StorePosition(uint Number);
29  virtual void RecalcPositions(uint Number);
30  virtual void GotoPosition(uint Number, int Longitude);
31  virtual void GotoAngle(int Longitude);
32  };
33 
34 class cScr : public cListObject {
35 private:
36  int devices;
37  int channel;
38  uint userBand;
39  int pin;
40  bool used;
41 public:
42  cScr(void);
43  bool Parse(const char *s);
44  int Devices(void) const { return devices; }
45  int Channel(void) const { return channel; }
46  uint UserBand(void) const { return userBand; }
47  int Pin(void) const { return pin; }
48  bool Used(void) const { return used; }
49  void SetUsed(bool Used) { used = Used; }
50  };
51 
52 class cScrs : public cConfig<cScr> {
53 private:
55 public:
56  bool Load(const char *FileName, bool AllowComments = false, bool MustExist = false);
57  cScr *GetUnused(int Device);
58  };
59 
60 extern cScrs Scrs;
61 
62 class cDiseqc : public cListObject {
63 public:
77  };
78  enum { MaxDiseqcCodes = 6 };
79 private:
80  int devices;
81  int source;
82  int slof;
84  int lof;
85  mutable int position;
86  mutable int scrBank;
87  char *commands;
88  bool parsing;
89  uint SetScrFrequency(uint SatFrequency, const cScr *Scr, uint8_t *Codes) const;
90  int SetScrPin(const cScr *Scr, uint8_t *Codes) const;
91  const char *Wait(const char *s) const;
92  const char *GetPosition(const char *s) const;
93  const char *GetScrBank(const char *s) const;
94  const char *GetCodes(const char *s, uchar *Codes = NULL, uint8_t *MaxCodes = NULL) const;
95 public:
96  cDiseqc(void);
97  ~cDiseqc();
98  bool Parse(const char *s);
99  eDiseqcActions Execute(const char **CurrentAction, uchar *Codes, uint8_t *MaxCodes, const cScr *Scr, uint *Frequency) const;
115  int Devices(void) const { return devices; }
118  int Source(void) const { return source; }
120  int Slof(void) const { return slof; }
122  char Polarization(void) const { return polarization; }
124  int Lof(void) const { return lof; }
126  int Position(void) const { return position; }
132  bool IsScr(void) const { return scrBank >= 0; }
134  const char *Commands(void) const { return commands; }
136  };
137 
138 class cDiseqcs : public cConfig<cDiseqc> {
139 public:
140  bool Load(const char *FileName, bool AllowComments = false, bool MustExist = false);
141  const cDiseqc *Get(int Device, int Source, int Frequency, char Polarization, const cScr **Scr) const;
149  };
150 
151 extern cDiseqcs Diseqcs;
152 
153 #endif //__DISEQC_H
virtual void DisableLimits(void)
Disables the soft limits for the dish movement.
Definition: diseqc.c:105
uint userBand
Definition: diseqc.h:38
unsigned char uchar
Definition: tools.h:30
const char * Wait(const char *s) const
Definition: diseqc.c:307
~cDiseqc()
Definition: diseqc.c:219
bool parsing
Definition: diseqc.h:88
bool IsScr(void) const
Returns true if this DiSEqC sequence uses Satellite Channel Routing.
Definition: diseqc.h:132
uint UserBand(void) const
Definition: diseqc.h:46
bool Parse(const char *s)
Definition: diseqc.c:159
int Position(void) const
Indicates which positioning mode to use in order to move the dish to a given satellite position...
Definition: diseqc.h:126
void SetUsed(bool Used)
Definition: diseqc.h:49
char Polarization(void) const
Returns the signal polarization this DiSEqC sequence applies to.
Definition: diseqc.h:122
int lof
Definition: diseqc.h:84
int pin
Definition: diseqc.h:39
Definition: diseqc.h:52
virtual void EnableLimits(void)
Enables the soft limits for the dish movement.
Definition: diseqc.c:111
eDiseqcActions Execute(const char **CurrentAction, uchar *Codes, uint8_t *MaxCodes, const cScr *Scr, uint *Frequency) const
Parses the DiSEqC commands and returns the appropriate action code with every call.
Definition: diseqc.c:402
int devices
Definition: diseqc.h:80
int source
Definition: diseqc.h:81
virtual void StorePosition(uint Number)
Store the current position as a satellite position with the given Number.
Definition: diseqc.c:117
virtual void Drive(ePositionerDirection Direction)
Continuously move the dish to the given Direction until Halt() is called or it hits the soft or hard ...
Definition: diseqc.c:78
const char * FileName(void)
Definition: config.h:119
Definition: diseqc.h:62
int Pin(void) const
Definition: diseqc.h:47
int position
Definition: diseqc.h:85
A steerable satellite dish generally points to the south on the northern hemisphere, and to the north on the southern hemisphere (unless you're located directly on the equator, in which case the general direction is "up").
Definition: positioner.h:31
virtual void Halt(void)
Stop any ongoing motion of the dish.
Definition: diseqc.c:93
int Slof(void) const
Returns the switch frequency of the LNB this DiSEqC sequence applies to.
Definition: diseqc.h:120
cScr(void)
Definition: diseqc.c:150
virtual void SetLimit(ePositionerDirection Direction)
Set the soft limit of the dish movement in the given Direction to the current position.
Definition: diseqc.c:99
virtual void GotoPosition(uint Number, int Longitude)
Move the dish to the satellite position stored under the given Number.
Definition: diseqc.c:129
uint SetScrFrequency(uint SatFrequency, const cScr *Scr, uint8_t *Codes) const
Definition: diseqc.c:256
ePositionerDirection
Definition: positioner.h:83
virtual void GotoAngle(int Longitude)
Move the dish to the given angular position.
Definition: diseqc.c:136
int Devices(void) const
Returns an integer where each bit represents one of the system's devices.
Definition: diseqc.h:115
bool Used(void) const
Definition: diseqc.h:48
const char * GetScrBank(const char *s) const
Definition: diseqc.c:343
bool Load(const char *FileName, bool AllowComments=false, bool MustExist=false)
Definition: diseqc.c:441
Definition: thread.h:63
bool used
Definition: diseqc.h:40
int Devices(void) const
Definition: diseqc.h:44
cMutex mutex
Definition: diseqc.h:54
cDiseqcPositioner(void)
Definition: diseqc.c:51
virtual void Step(ePositionerDirection Direction, uint Steps=1)
Move the dish the given number of Steps in the given Direction.
Definition: diseqc.c:84
const char * GetCodes(const char *s, uchar *Codes=NULL, uint8_t *MaxCodes=NULL) const
Definition: diseqc.c:361
int channel
Definition: diseqc.h:37
cScr * GetUnused(int Device)
Definition: diseqc.c:190
Definition: diseqc.h:34
const char * Commands(void) const
Returns a pointer to the actual commands of this DiSEqC sequence.
Definition: diseqc.h:134
eDiseqcActions
Definition: diseqc.h:64
const cDiseqc * Get(int Device, int Source, int Frequency, char Polarization, const cScr **Scr) const
Selects a DiSEqC entry suitable for the given Device and tuning parameters.
Definition: diseqc.c:447
cScrs Scrs
Definition: diseqc.c:182
int SetScrPin(const cScr *Scr, uint8_t *Codes) const
Definition: diseqc.c:281
char polarization
Definition: diseqc.h:83
const char * GetPosition(const char *s) const
Definition: diseqc.c:321
cDiseqcs Diseqcs
Definition: diseqc.c:439
bool Load(const char *FileName, bool AllowComments=false, bool MustExist=false)
Definition: diseqc.c:184
int Channel(void) const
Definition: diseqc.h:45
int devices
Definition: diseqc.h:36
char * commands
Definition: diseqc.h:87
void SendDiseqc(uint8_t *Codes, int NumCodes)
Definition: diseqc.c:66
int Lof(void) const
Returns the local oscillator frequency of the LNB this DiSEqC sequence applies to.
Definition: diseqc.h:124
int slof
Definition: diseqc.h:82
cDiseqc(void)
Definition: diseqc.c:206
bool Parse(const char *s)
Definition: diseqc.c:224
int scrBank
Definition: diseqc.h:86
int Source(void) const
Returns the satellite source this DiSEqC sequence applies to.
Definition: diseqc.h:118
virtual void RecalcPositions(uint Number)
Take the difference between the current actual position of the dish and the position stored with the ...
Definition: diseqc.c:123