diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2011-09-11 14:09:03 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2011-09-11 14:09:03 +0200 |
commit | 413a0e6373f272f687db611185bc268c0d44f3b3 (patch) | |
tree | 046714f5e79e8ec57b4e7c64684dfe231d0109da /diseqc.h | |
parent | 78e89efee8a54d4343183fc98a34d13f9e0ef478 (diff) | |
download | vdr-413a0e6373f272f687db611185bc268c0d44f3b3.tar.gz vdr-413a0e6373f272f687db611185bc268c0d44f3b3.tar.bz2 |
VDR now supports "Satellite Channel Routing" (SCR)
Diffstat (limited to 'diseqc.h')
-rw-r--r-- | diseqc.h | 71 |
1 files changed, 57 insertions, 14 deletions
@@ -4,13 +4,39 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: diseqc.h 2.3 2011/09/10 13:36:50 kls Exp $ + * $Id: diseqc.h 2.4 2011/09/11 13:40:16 kls Exp $ */ #ifndef __DISEQC_H #define __DISEQC_H #include "config.h" +#include "thread.h" + +class cScr : public cListObject { +private: + int channel; + uint userBand; + int pin; + bool used; +public: + cScr(void); + bool Parse(const char *s); + int Channel(void) const { return channel; } + uint UserBand(void) const { return userBand; } + int Pin(void) const { return pin; } + bool Used(void) const { return used; } + void SetUsed(bool Used) { used = Used; } + }; + +class cScrs : public cConfig<cScr> { +private: + cMutex mutex; +public: + cScr *GetUnused(void); + }; + +extern cScrs Scrs; class cDiseqc : public cListObject { public: @@ -22,6 +48,7 @@ public: daVoltage18, daMiniA, daMiniB, + daScr, daCodes, }; enum { MaxDiseqcCodes = 6 }; @@ -31,37 +58,53 @@ private: int slof; char polarization; int lof; + mutable int scrBank; char *commands; bool parsing; + uint SetScrFrequency(uint SatFrequency, const cScr *Scr, uint8_t *Codes) const; + int SetScrPin(const cScr *Scr, uint8_t *Codes) const; const char *Wait(const char *s) const; + const char *GetScrBank(const char *s) const; const char *GetCodes(const char *s, uchar *Codes = NULL, uint8_t *MaxCodes = NULL) const; public: cDiseqc(void); ~cDiseqc(); bool Parse(const char *s); - eDiseqcActions Execute(const char **CurrentAction, uchar *Codes, uint8_t *MaxCodes) const; - // Parses the DiSEqC commands and returns the appropriate action code - // with every call. CurrentAction must be the address of a character pointer, - // which is initialized to NULL. This pointer is used internally while parsing - // the commands and shall not be modified once Execute() has been called with - // it. Call Execute() repeatedly (always providing the same CurrentAction pointer) - // until it returns daNone. After a successful execution of all commands - // *CurrentAction points to the value 0x00. - // If the current action consists of sending code bytes to the device, those - // bytes will be copied into Codes. MaxCodes must be initialized to the maximum - // number of bytes Codes can handle, and will be set to the actual number of - // bytes copied to Codes upon return. + 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. CurrentAction must be the address of a character pointer, + ///< which is initialized to NULL. This pointer is used internally while parsing + ///< the commands and shall not be modified once Execute() has been called with + ///< it. Call Execute() repeatedly (always providing the same CurrentAction pointer) + ///< until it returns daNone. After a successful execution of all commands + ///< *CurrentAction points to the value 0x00. + ///< If the current action consists of sending code bytes to the device, those + ///< bytes will be copied into Codes. MaxCodes must be initialized to the maximum + ///< number of bytes Codes can handle, and will be set to the actual number of + ///< bytes copied to Codes upon return. + ///< If this DiSEqC entry requires SCR, the given Scr will be used. This must + ///< be a pointer returned from a previous call to cDiseqcs::Get(). + ///< Frequency must be the frequency the tuner will be tuned to, and will be + ///< set to the proper SCR frequency upon return (if SCR is used). int Devices(void) const { return devices; } int Source(void) const { return source; } int Slof(void) const { return slof; } char Polarization(void) const { return polarization; } int Lof(void) const { return lof; } + bool IsScr() const { return scrBank >= 0; } const char *Commands(void) const { return commands; } }; class cDiseqcs : public cConfig<cDiseqc> { public: - const cDiseqc *Get(int Device, int Source, int Frequency, char Polarization) const; + 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. + ///< If this DiSEqC entry requires SCR and the given *Scr is NULL + ///< a free one will be selected from the Scrs and a pointer to that will + ///< be returned in Scr. The caller shall memorize that pointer and reuse it in + ///< subsequent calls. + ///< Scr may be NULL for checking whether there is any DiSEqC entry for the + ///< given transponder. }; extern cDiseqcs Diseqcs; |