2014-03-13 17:23:55 +01:00
|
|
|
/*
|
|
|
|
* server.h: SAT>IP plugin for the Video Disk Recorder
|
|
|
|
*
|
|
|
|
* See the README file for copyright information and how to reach the author.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __SATIP_SERVER_H
|
|
|
|
#define __SATIP_SERVER_H
|
|
|
|
|
|
|
|
// --- cSatipServer -----------------------------------------------------------
|
|
|
|
|
|
|
|
class cSatipServer : public cListObject {
|
|
|
|
private:
|
|
|
|
enum eSatipModule {
|
|
|
|
eSatipModuleDVBS2 = 0,
|
|
|
|
eSatipModuleDVBT,
|
|
|
|
eSatipModuleDVBT2,
|
2014-10-30 21:10:09 +01:00
|
|
|
eSatipModuleDVBC,
|
2014-11-20 21:30:18 +01:00
|
|
|
eSatipModuleDVBC2,
|
2014-03-13 17:23:55 +01:00
|
|
|
eSatipModuleCount
|
|
|
|
};
|
|
|
|
cString addressM;
|
|
|
|
cString modelM;
|
2014-11-10 23:05:03 +01:00
|
|
|
cString descriptionM;
|
2014-03-13 17:23:55 +01:00
|
|
|
int modelCountM[eSatipModuleCount];
|
|
|
|
int modelTypeM;
|
2014-05-08 21:09:35 +02:00
|
|
|
int quirkM;
|
2014-03-13 17:23:55 +01:00
|
|
|
int useCountM;
|
2014-11-01 15:31:44 +01:00
|
|
|
int transponderM;
|
2014-03-13 17:23:55 +01:00
|
|
|
time_t createdM;
|
|
|
|
cTimeMs lastSeenM;
|
|
|
|
|
|
|
|
public:
|
2014-05-08 21:09:35 +02:00
|
|
|
enum eSatipQuirk {
|
|
|
|
eSatipQuirkNone = 0x00,
|
|
|
|
eSatipQuirkSessionId = 0x01,
|
2014-10-31 17:18:33 +01:00
|
|
|
eSatipQuirkPlayPids = 0x02,
|
2014-11-03 20:54:19 +01:00
|
|
|
eSatipQuirkForceLock = 0x04,
|
2015-01-05 23:58:35 +01:00
|
|
|
eSatipQuirkUseXPMT = 0x08,
|
2014-05-08 21:09:35 +02:00
|
|
|
eSatipQuirkMask = 0x0F
|
|
|
|
};
|
2014-03-13 17:23:55 +01:00
|
|
|
enum eSatipModelType {
|
2014-05-08 21:09:35 +02:00
|
|
|
eSatipModelTypeNone = 0x00,
|
2014-03-13 17:23:55 +01:00
|
|
|
eSatipModelTypeDVBS2 = 0x01,
|
|
|
|
eSatipModelTypeDVBT = 0x02,
|
|
|
|
eSatipModelTypeDVBT2 = 0x04,
|
|
|
|
eSatipModelTypeDVBC = 0x08,
|
2014-11-20 21:30:18 +01:00
|
|
|
eSatipModelTypeDVBC2 = 0x10,
|
|
|
|
eSatipModelTypeMask = 0xFF
|
2014-03-13 17:23:55 +01:00
|
|
|
};
|
2014-11-10 23:05:03 +01:00
|
|
|
cSatipServer(const char *addressP, const char *modelP, const char *descriptionP);
|
2014-03-13 17:23:55 +01:00
|
|
|
virtual ~cSatipServer();
|
|
|
|
virtual int Compare(const cListObject &listObjectP) const;
|
|
|
|
void Use(bool onOffP);
|
2014-11-01 15:31:44 +01:00
|
|
|
void SetTransponder(const int transponderP) { transponderM = transponderP; }
|
|
|
|
int Transponder(void) { return transponderM; }
|
2014-03-13 17:23:55 +01:00
|
|
|
bool Used(void) { return !!useCountM; }
|
|
|
|
const char *Address() { return *addressM; }
|
2014-11-10 23:05:03 +01:00
|
|
|
const char *Model(void) { return *modelM; }
|
|
|
|
const char *Description() { return *descriptionM; }
|
2014-05-08 21:09:35 +02:00
|
|
|
bool Quirk(int quirkP) { return ((quirkP & eSatipQuirkMask) & quirkM); }
|
2014-03-13 17:23:55 +01:00
|
|
|
int ModelType(void) { return modelTypeM; }
|
|
|
|
bool Match(int modelP) { return ((modelP & eSatipModelTypeMask) & modelTypeM); }
|
2014-11-20 21:30:18 +01:00
|
|
|
int Cable() { return Match(eSatipModelTypeDVBC) ? modelCountM[eSatipModuleDVBC] : 0; }
|
|
|
|
int Cable2() { return Match(eSatipModelTypeDVBC2) ? modelCountM[eSatipModuleDVBC2] : 0; }
|
2014-03-13 17:23:55 +01:00
|
|
|
int Satellite() { return Match(eSatipModelTypeDVBS2) ? modelCountM[eSatipModuleDVBS2] : 0; }
|
|
|
|
int Terrestrial() { return Match(eSatipModelTypeDVBT) ? modelCountM[eSatipModuleDVBT] : 0; }
|
|
|
|
int Terrestrial2() { return Match(eSatipModelTypeDVBT2) ? modelCountM[eSatipModuleDVBT2] : 0; }
|
|
|
|
void Update(void) { lastSeenM.Set(); }
|
|
|
|
uint64_t LastSeen(void) { return lastSeenM.Elapsed(); }
|
|
|
|
time_t Created(void) { return createdM; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// --- cSatipServers ----------------------------------------------------------
|
|
|
|
|
|
|
|
class cSatipServers : public cList<cSatipServer> {
|
|
|
|
public:
|
|
|
|
cSatipServer *Find(cSatipServer *serverP);
|
2014-11-01 15:31:44 +01:00
|
|
|
cSatipServer *Find(int sourceP, int transponderP, int systemP);
|
|
|
|
void SetTransponder(cSatipServer *serverP, bool transponderP);
|
2014-03-13 17:23:55 +01:00
|
|
|
cSatipServer *Update(cSatipServer *serverP);
|
|
|
|
void Use(cSatipServer *serverP, bool onOffP);
|
|
|
|
void Cleanup(uint64_t intervalMsP = 0);
|
|
|
|
cString GetString(cSatipServer *serverP);
|
|
|
|
cString List(void);
|
|
|
|
int NumProvidedSystems(void);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __SATIP_SERVER_H
|