vdr 2.6.7
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 4.1 2017/01/09 15:11:19 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
18private:
19 void SendDiseqc(uint8_t *Codes, int NumCodes);
20public:
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
34class cScr : public cListObject {
35private:
39 int pin;
40 bool used;
41public:
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
52class cScrs : public cConfig<cScr> {
53private:
55public:
56 bool Load(const char *FileName, bool AllowComments = false, bool MustExist = false);
57 cScr *GetUnused(int Device);
58 };
59
60extern cScrs Scrs;
61
62class cDiseqc : public cListObject {
63public:
78 enum { MaxDiseqcCodes = 6 };
79private:
81 int source;
82 int slof;
84 int lof;
85 mutable int position;
86 mutable int scrBank;
87 char *commands;
88 bool parsing;
89 int SetScrFrequency(int 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;
95public:
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, int *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
138class cDiseqcs : public cConfig<cDiseqc> {
139public:
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
151extern cDiseqcs Diseqcs;
152
153#endif //__DISEQC_H
const char * FileName(void)
Definition config.h:126
virtual void DisableLimits(void)
Disables the soft limits for the dish movement.
Definition diseqc.c:105
void SendDiseqc(uint8_t *Codes, int NumCodes)
Definition diseqc.c:66
virtual void GotoPosition(uint Number, int Longitude)
Move the dish to the satellite position stored under the given Number.
Definition diseqc.c:129
virtual void GotoAngle(int Longitude)
Move the dish to the given angular position.
Definition diseqc.c:136
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 Step(ePositionerDirection Direction, uint Steps=1)
Move the dish the given number of Steps in the given Direction.
Definition diseqc.c:84
virtual void Halt(void)
Stop any ongoing motion of the dish.
Definition diseqc.c:93
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
virtual void EnableLimits(void)
Enables the soft limits for the dish movement.
Definition diseqc.c:111
virtual void StorePosition(uint Number)
Store the current position as a satellite position with the given Number.
Definition diseqc.c:117
cDiseqcPositioner(void)
Definition diseqc.c:51
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
@ MaxDiseqcCodes
Definition diseqc.h:78
eDiseqcActions Execute(const char **CurrentAction, uchar *Codes, uint8_t *MaxCodes, const cScr *Scr, int *Frequency) const
Parses the DiSEqC commands and returns the appropriate action code with every call.
Definition diseqc.c:402
char polarization
Definition diseqc.h:83
bool Parse(const char *s)
Definition diseqc.c:224
const char * Commands(void) const
Returns a pointer to the actual commands of this DiSEqC sequence.
Definition diseqc.h:134
int devices
Definition diseqc.h:80
int Slof(void) const
Returns the switch frequency of the LNB this DiSEqC sequence applies to.
Definition diseqc.h:120
int position
Definition diseqc.h:85
int Source(void) const
Returns the satellite source this DiSEqC sequence applies to.
Definition diseqc.h:118
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
int slof
Definition diseqc.h:82
const char * GetPosition(const char *s) const
Definition diseqc.c:321
const char * Wait(const char *s) const
Definition diseqc.c:307
int SetScrFrequency(int SatFrequency, const cScr *Scr, uint8_t *Codes) const
Definition diseqc.c:256
~cDiseqc()
Definition diseqc.c:219
const char * GetCodes(const char *s, uchar *Codes=NULL, uint8_t *MaxCodes=NULL) const
Definition diseqc.c:361
int scrBank
Definition diseqc.h:86
bool parsing
Definition diseqc.h:88
char * commands
Definition diseqc.h:87
char Polarization(void) const
Returns the signal polarization this DiSEqC sequence applies to.
Definition diseqc.h:122
int source
Definition diseqc.h:81
int lof
Definition diseqc.h:84
int Devices(void) const
Returns an integer where each bit represents one of the system's devices.
Definition diseqc.h:115
int Lof(void) const
Returns the local oscillator frequency of the LNB this DiSEqC sequence applies to.
Definition diseqc.h:124
int SetScrPin(const cScr *Scr, uint8_t *Codes) const
Definition diseqc.c:281
const char * GetScrBank(const char *s) const
Definition diseqc.c:343
bool IsScr(void) const
Returns true if this DiSEqC sequence uses Satellite Channel Routing.
Definition diseqc.h:132
eDiseqcActions
Definition diseqc.h:64
@ daMiniB
Definition diseqc.h:71
@ daNone
Definition diseqc.h:65
@ daPositionN
Definition diseqc.h:72
@ daMiniA
Definition diseqc.h:70
@ daCodes
Definition diseqc.h:75
@ daVoltage13
Definition diseqc.h:68
@ daWait
Definition diseqc.h:76
@ daToneOff
Definition diseqc.h:66
@ daToneOn
Definition diseqc.h:67
@ daVoltage18
Definition diseqc.h:69
@ daPositionA
Definition diseqc.h:73
@ daScr
Definition diseqc.h:74
cDiseqc(void)
Definition diseqc.c:206
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
bool Load(const char *FileName, bool AllowComments=false, bool MustExist=false)
Definition diseqc.c:441
A steerable satellite dish generally points to the south on the northern hemisphere,...
Definition positioner.h:31
Definition diseqc.h:34
uint UserBand(void) const
Definition diseqc.h:46
bool Used(void) const
Definition diseqc.h:48
int Channel(void) const
Definition diseqc.h:45
int devices
Definition diseqc.h:36
cScr(void)
Definition diseqc.c:150
bool used
Definition diseqc.h:40
uint userBand
Definition diseqc.h:38
bool Parse(const char *s)
Definition diseqc.c:159
int Devices(void) const
Definition diseqc.h:44
int Pin(void) const
Definition diseqc.h:47
int channel
Definition diseqc.h:37
void SetUsed(bool Used)
Definition diseqc.h:49
int pin
Definition diseqc.h:39
Definition diseqc.h:52
bool Load(const char *FileName, bool AllowComments=false, bool MustExist=false)
Definition diseqc.c:184
cMutex mutex
Definition diseqc.h:54
cScr * GetUnused(int Device)
Definition diseqc.c:190
cDiseqcs Diseqcs
Definition diseqc.c:439
cScrs Scrs
Definition diseqc.c:182
unsigned char uchar
Definition tools.h:31