2002-10-06 10:25:42 +02:00
|
|
|
/*
|
|
|
|
* sources.h: Source handling
|
|
|
|
*
|
|
|
|
* See the main source file 'vdr.c' for copyright information and
|
|
|
|
* how to reach the author.
|
|
|
|
*
|
2014-03-09 12:11:32 +01:00
|
|
|
* $Id: sources.h 3.3 2014/03/09 11:59:49 kls Exp $
|
2002-10-06 10:25:42 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __SOURCES_H
|
|
|
|
#define __SOURCES_H
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
class cSource : public cListObject {
|
|
|
|
public:
|
|
|
|
enum eSourceType {
|
2010-02-28 12:19:50 +01:00
|
|
|
stNone = 0x00000000,
|
2010-03-06 12:01:17 +01:00
|
|
|
stAtsc = ('A' << 24),
|
2010-02-28 12:19:50 +01:00
|
|
|
stCable = ('C' << 24),
|
|
|
|
stSat = ('S' << 24),
|
|
|
|
stTerr = ('T' << 24),
|
|
|
|
st_Mask = 0xFF000000,
|
|
|
|
st_Pos = 0x0000FFFF,
|
2013-08-21 11:02:52 +02:00
|
|
|
st_Any = 0x00000E10, // 3600 - special value indicating "any position"
|
2002-10-06 10:25:42 +02:00
|
|
|
};
|
|
|
|
private:
|
|
|
|
int code;
|
|
|
|
char *description;
|
|
|
|
public:
|
|
|
|
cSource(void);
|
2010-02-28 12:19:50 +01:00
|
|
|
cSource(char Source, const char *Description);
|
2002-10-06 10:25:42 +02:00
|
|
|
~cSource();
|
|
|
|
int Code(void) const { return code; }
|
2013-04-11 10:40:47 +02:00
|
|
|
int Position(void) { return Position(code); }
|
|
|
|
///< Returns the orbital position of the satellite in case this is a DVB-S
|
2013-08-21 11:02:52 +02:00
|
|
|
///< source (zero otherwise). The returned value is in the range -1800...+1800,
|
|
|
|
///< except for the special value 3600, which indicates "any position". This is
|
|
|
|
///< used with positioners that can move the dish to any requested satellite
|
|
|
|
///< within their range.
|
2013-04-11 10:40:47 +02:00
|
|
|
///< A positive sign indicates a position east of Greenwich, while western
|
|
|
|
///< positions have a negative sign. The absolute value is in "degrees * 10",
|
|
|
|
///< which allows for a resolution of 1/10 of a degree.
|
2002-10-06 10:25:42 +02:00
|
|
|
const char *Description(void) const { return description; }
|
|
|
|
bool Parse(const char *s);
|
2013-08-21 11:02:52 +02:00
|
|
|
static bool Matches(int Code1, int Code2);
|
|
|
|
///< Returns true if Code2 matches Code1. This is simply a check whether the
|
|
|
|
///< two codes are equal, except for the special case that Code1 is stSat|st_Any,
|
|
|
|
///< in which case it matches any Code2 that is stSat.
|
2013-04-11 10:40:47 +02:00
|
|
|
static int Position(int Code);
|
2012-06-17 12:27:07 +02:00
|
|
|
static char ToChar(int Code) { return (Code & st_Mask) >> 24; }
|
2004-12-26 12:45:22 +01:00
|
|
|
static cString ToString(int Code);
|
2002-10-06 10:25:42 +02:00
|
|
|
static int FromString(const char *s);
|
2004-01-11 15:54:37 +01:00
|
|
|
static int FromData(eSourceType SourceType, int Position = 0, bool East = false);
|
2010-03-06 12:01:17 +01:00
|
|
|
static bool IsAtsc(int Code) { return (Code & st_Mask) == stAtsc; }
|
2005-05-14 09:47:06 +02:00
|
|
|
static bool IsCable(int Code) { return (Code & st_Mask) == stCable; }
|
|
|
|
static bool IsSat(int Code) { return (Code & st_Mask) == stSat; }
|
|
|
|
static bool IsTerr(int Code) { return (Code & st_Mask) == stTerr; }
|
2010-03-07 13:56:09 +01:00
|
|
|
static bool IsType(int Code, char Source) { return int(Code & st_Mask) == (int(Source) << 24); }
|
2002-10-06 10:25:42 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
class cSources : public cConfig<cSource> {
|
|
|
|
public:
|
|
|
|
cSource *Get(int Code);
|
2014-03-09 12:11:32 +01:00
|
|
|
bool ContainsSourceType(char SourceType);
|
2002-10-06 10:25:42 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
extern cSources Sources;
|
|
|
|
|
|
|
|
#endif //__SOURCES_H
|