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
|
|
|
|
|
2015-01-15 22:33:51 +01:00
|
|
|
class cSatipServer;
|
|
|
|
|
|
|
|
// --- cSatipFrontend ---------------------------------------------------------
|
|
|
|
|
|
|
|
class cSatipFrontend : public cListObject {
|
|
|
|
private:
|
|
|
|
int indexM;
|
|
|
|
int transponderM;
|
2015-02-16 16:21:00 +01:00
|
|
|
int deviceIdM;
|
2015-01-15 22:33:51 +01:00
|
|
|
cString descriptionM;
|
|
|
|
|
|
|
|
public:
|
|
|
|
cSatipFrontend(const int indexP, const char *descriptionP);
|
|
|
|
virtual ~cSatipFrontend();
|
2015-02-16 16:21:00 +01:00
|
|
|
void Attach(int deviceIdP) { deviceIdM = deviceIdP; }
|
|
|
|
void Detach(int deviceIdP) { if (deviceIdP == deviceIdM) deviceIdM = -1; }
|
2015-01-15 22:33:51 +01:00
|
|
|
cString Description(void) { return descriptionM; }
|
2015-02-16 16:21:00 +01:00
|
|
|
bool Attached(void) { return (deviceIdM >= 0); }
|
2015-01-15 22:33:51 +01:00
|
|
|
int Index(void) { return indexM; }
|
|
|
|
int Transponder(void) { return transponderM; }
|
2015-02-16 18:42:18 +01:00
|
|
|
int DeviceId(void) { return deviceIdM; }
|
2015-01-15 22:33:51 +01:00
|
|
|
void SetTransponder(int transponderP) { transponderM = transponderP; }
|
|
|
|
};
|
|
|
|
|
|
|
|
// --- cSatipFrontends --------------------------------------------------------
|
|
|
|
|
|
|
|
class cSatipFrontends : public cList<cSatipFrontend> {
|
|
|
|
public:
|
2015-02-16 16:21:00 +01:00
|
|
|
bool Matches(int deviceIdP, int transponderP);
|
|
|
|
bool Assign(int deviceIdP, int transponderP);
|
|
|
|
bool Attach(int deviceIdP, int transponderP);
|
|
|
|
bool Detach(int deviceIdP, int transponderP);
|
2015-01-15 22:33:51 +01:00
|
|
|
};
|
|
|
|
|
2014-03-13 17:23:55 +01:00
|
|
|
// --- cSatipServer -----------------------------------------------------------
|
|
|
|
|
|
|
|
class cSatipServer : public cListObject {
|
|
|
|
private:
|
2015-01-15 22:33:51 +01:00
|
|
|
enum eSatipFrontend {
|
|
|
|
eSatipFrontendDVBS2 = 0,
|
|
|
|
eSatipFrontendDVBT,
|
|
|
|
eSatipFrontendDVBT2,
|
|
|
|
eSatipFrontendDVBC,
|
|
|
|
eSatipFrontendDVBC2,
|
|
|
|
eSatipFrontendCount
|
2014-03-13 17:23:55 +01:00
|
|
|
};
|
2016-07-23 21:40:01 +02:00
|
|
|
enum {
|
|
|
|
eSatipMaxSourceFilters = 16
|
|
|
|
};
|
2014-03-13 17:23:55 +01:00
|
|
|
cString addressM;
|
|
|
|
cString modelM;
|
2016-07-23 21:40:01 +02:00
|
|
|
cString filtersM;
|
2014-11-10 23:05:03 +01:00
|
|
|
cString descriptionM;
|
2015-01-27 15:27:23 +01:00
|
|
|
cString quirksM;
|
2015-01-15 22:33:51 +01:00
|
|
|
cSatipFrontends frontendsM[eSatipFrontendCount];
|
2016-07-23 21:40:01 +02:00
|
|
|
int sourceFiltersM[eSatipMaxSourceFilters];
|
2016-02-22 16:58:33 +01:00
|
|
|
int portM;
|
2014-05-08 21:09:35 +02:00
|
|
|
int quirkM;
|
2015-01-25 23:21:55 +01:00
|
|
|
bool hasCiM;
|
2016-06-22 21:27:53 +02:00
|
|
|
bool activeM;
|
2014-03-13 17:23:55 +01:00
|
|
|
time_t createdM;
|
|
|
|
cTimeMs lastSeenM;
|
2016-07-23 21:40:01 +02:00
|
|
|
bool IsValidSource(int sourceP);
|
2014-03-13 17:23:55 +01:00
|
|
|
|
|
|
|
public:
|
2014-05-08 21:09:35 +02:00
|
|
|
enum eSatipQuirk {
|
2016-06-20 17:14:38 +02:00
|
|
|
eSatipQuirkNone = 0x00,
|
|
|
|
eSatipQuirkSessionId = 0x01,
|
|
|
|
eSatipQuirkPlayPids = 0x02,
|
|
|
|
eSatipQuirkForceLock = 0x04,
|
|
|
|
eSatipQuirkRtpOverTcp = 0x08,
|
|
|
|
eSatipQuirkMask = 0x0F
|
2014-05-08 21:09:35 +02:00
|
|
|
};
|
2016-07-23 21:40:01 +02:00
|
|
|
cSatipServer(const char *addressP, const int portP, const char *modelP, const char *filtersP, const char *descriptionP);
|
2014-03-13 17:23:55 +01:00
|
|
|
virtual ~cSatipServer();
|
|
|
|
virtual int Compare(const cListObject &listObjectP) const;
|
2015-02-16 16:21:00 +01:00
|
|
|
bool Assign(int deviceIdP, int sourceP, int systemP, int transponderP);
|
2015-01-15 22:33:51 +01:00
|
|
|
bool Matches(int sourceP);
|
2015-02-16 16:21:00 +01:00
|
|
|
bool Matches(int deviceIdP, int sourceP, int systemP, int transponderP);
|
|
|
|
void Attach(int deviceIdP, int transponderP);
|
|
|
|
void Detach(int deviceIdP, int transponderP);
|
2015-01-15 22:33:51 +01:00
|
|
|
int GetModulesDVBS2(void);
|
|
|
|
int GetModulesDVBT(void);
|
|
|
|
int GetModulesDVBT2(void);
|
|
|
|
int GetModulesDVBC(void);
|
|
|
|
int GetModulesDVBC2(void);
|
2016-06-22 21:27:53 +02:00
|
|
|
void Activate(bool onOffP) { activeM = onOffP; }
|
2015-01-27 15:27:23 +01:00
|
|
|
const char *Address(void) { return *addressM; }
|
|
|
|
const char *Model(void) { return *modelM; }
|
2016-07-23 21:40:01 +02:00
|
|
|
const char *Filters(void) { return *filtersM; }
|
2015-01-27 15:27:23 +01:00
|
|
|
const char *Description(void) { return *descriptionM; }
|
|
|
|
const char *Quirks(void) { return *quirksM; }
|
2016-02-22 16:58:33 +01:00
|
|
|
int Port(void) { return portM; }
|
2015-01-27 15:27:23 +01:00
|
|
|
bool Quirk(int quirkP) { return ((quirkP & eSatipQuirkMask) & quirkM); }
|
|
|
|
bool HasQuirk(void) { return (quirkM != eSatipQuirkNone); }
|
|
|
|
bool HasCI(void) { return hasCiM; }
|
2016-06-22 21:27:53 +02:00
|
|
|
bool IsActive(void) { return activeM; }
|
2015-01-27 15:27:23 +01:00
|
|
|
void Update(void) { lastSeenM.Set(); }
|
|
|
|
uint64_t LastSeen(void) { return lastSeenM.Elapsed(); }
|
|
|
|
time_t Created(void) { return createdM; }
|
2014-03-13 17:23:55 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
// --- cSatipServers ----------------------------------------------------------
|
|
|
|
|
|
|
|
class cSatipServers : public cList<cSatipServer> {
|
|
|
|
public:
|
|
|
|
cSatipServer *Find(cSatipServer *serverP);
|
2015-01-15 22:33:51 +01:00
|
|
|
cSatipServer *Find(int sourceP);
|
2015-02-16 16:21:00 +01:00
|
|
|
cSatipServer *Assign(int deviceIdP, int sourceP, int transponderP, int systemP);
|
2014-03-13 17:23:55 +01:00
|
|
|
cSatipServer *Update(cSatipServer *serverP);
|
2016-06-22 21:27:53 +02:00
|
|
|
void Activate(cSatipServer *serverP, bool onOffP);
|
2015-02-16 16:21:00 +01:00
|
|
|
void Attach(cSatipServer *serverP, int deviceIdP, int transponderP);
|
|
|
|
void Detach(cSatipServer *serverP, int deviceIdP, int transponderP);
|
2015-01-15 22:33:51 +01:00
|
|
|
bool IsQuirk(cSatipServer *serverP, int quirkP);
|
2015-01-25 23:21:55 +01:00
|
|
|
bool HasCI(cSatipServer *serverP);
|
2014-03-13 17:23:55 +01:00
|
|
|
void Cleanup(uint64_t intervalMsP = 0);
|
2015-01-15 22:33:51 +01:00
|
|
|
cString GetAddress(cSatipServer *serverP);
|
2014-03-13 17:23:55 +01:00
|
|
|
cString GetString(cSatipServer *serverP);
|
2016-02-22 16:58:33 +01:00
|
|
|
int GetPort(cSatipServer *serverP);
|
2014-03-13 17:23:55 +01:00
|
|
|
cString List(void);
|
|
|
|
int NumProvidedSystems(void);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __SATIP_SERVER_H
|