vdr 2.6.1
include/vdr/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
17class cDiseqcPositioner : public cPositioner {
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:
36 int devices;
37 int channel;
38 uint userBand;
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:
65 daNone,
70 daMiniA,
71 daMiniB,
74 daScr,
75 daCodes,
76 daWait,
77 };
78 enum { MaxDiseqcCodes = 6 };
79private:
80 int devices;
81 int source;
82 int slof;
83 char polarization;
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);
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 StorePosition(uint Number)
Store the current position as a satellite position with the given Number.
void SendDiseqc(uint8_t *Codes, int NumCodes)
virtual void Drive(ePositionerDirection Direction)
Continuously move the dish to the given Direction until Halt() is called or it hits the soft or hard ...
virtual void SetLimit(ePositionerDirection Direction)
Set the soft limit of the dish movement in the given Direction to the current position.
virtual void Step(ePositionerDirection Direction, uint Steps=1)
Move the dish the given number of Steps in the given Direction.
virtual void DisableLimits(void)
Disables the soft limits for the dish movement.
virtual void Halt(void)
Stop any ongoing motion of the dish.
virtual void GotoAngle(int Longitude)
Move the dish to the given angular position.
virtual void EnableLimits(void)
Enables the soft limits for the dish movement.
virtual void GotoPosition(uint Number, int Longitude)
Move the dish to the satellite position stored under the given Number.
virtual void RecalcPositions(uint Number)
Take the difference between the current actual position of the dish and the position stored with the ...
Definition: diseqc.h:62
char polarization
Definition: diseqc.h:83
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.
bool Parse(const char *s)
const char * Commands(void) const
Returns a pointer to the actual commands of this DiSEqC sequence.
char * commands
Definition: diseqc.h:87
int devices
Definition: diseqc.h:80
int Slof(void) const
Returns the switch frequency of the LNB this DiSEqC sequence applies to.
int position
Definition: diseqc.h:85
int Source(void) const
Returns the satellite source this DiSEqC sequence applies to.
int Position(void) const
Indicates which positioning mode to use in order to move the dish to a given satellite position.
int slof
Definition: diseqc.h:82
const char * GetPosition(const char *s) const
const char * Wait(const char *s) const
int SetScrFrequency(int SatFrequency, const cScr *Scr, uint8_t *Codes) const
const char * GetCodes(const char *s, uchar *Codes=NULL, uint8_t *MaxCodes=NULL) const
int scrBank
Definition: diseqc.h:86
bool parsing
Definition: diseqc.h:88
char Polarization(void) const
Returns the signal polarization this DiSEqC sequence applies to.
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.
int Lof(void) const
Returns the local oscillator frequency of the LNB this DiSEqC sequence applies to.
int SetScrPin(const cScr *Scr, uint8_t *Codes) const
const char * GetScrBank(const char *s) const
@ MaxDiseqcCodes
Definition: diseqc.h:78
bool IsScr(void) const
Returns true if this DiSEqC sequence uses Satellite Channel Routing.
eDiseqcActions
Definition: diseqc.h:64
@ daVoltage18
Definition: diseqc.h:69
@ daToneOff
Definition: diseqc.h:66
@ daNone
Definition: diseqc.h:65
@ daScr
Definition: diseqc.h:74
@ daCodes
Definition: diseqc.h:75
@ daToneOn
Definition: diseqc.h:67
@ daMiniA
Definition: diseqc.h:70
@ daWait
Definition: diseqc.h:76
@ daPositionA
Definition: diseqc.h:73
@ daMiniB
Definition: diseqc.h:71
@ daPositionN
Definition: diseqc.h:72
@ daVoltage13
Definition: diseqc.h:68
cDiseqc(void)
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.
bool Load(const char *FileName, bool AllowComments=false, bool MustExist=false)
A steerable satellite dish generally points to the south on the northern hemisphere,...
Definition: diseqc.h:34
uint UserBand(void) const
bool Used(void) const
int Channel(void) const
int devices
Definition: diseqc.h:36
cScr(void)
bool used
Definition: diseqc.h:40
uint userBand
Definition: diseqc.h:38
bool Parse(const char *s)
int Devices(void) const
int Pin(void) const
int channel
Definition: diseqc.h:37
void SetUsed(bool Used)
int pin
Definition: diseqc.h:39
Definition: diseqc.h:52
bool Load(const char *FileName, bool AllowComments=false, bool MustExist=false)
cMutex mutex
Definition: diseqc.h:54
cScr * GetUnused(int Device)
cDiseqcs Diseqcs
Definition: diseqc.c:439
cScrs Scrs
Definition: diseqc.c:182
unsigned char uchar