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 ,
eSatipModuleCount
} ;
cString addressM ;
cString descriptionM ;
cString modelM ;
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 ;
time_t createdM ;
cTimeMs lastSeenM ;
public :
2014-05-08 21:09:35 +02:00
enum eSatipQuirk {
eSatipQuirkNone = 0x00 ,
eSatipQuirkSessionId = 0x01 ,
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 ,
eSatipModelTypeMask = 0x0F
} ;
cSatipServer ( const char * addressP , const char * descriptionP , const char * modelP ) ;
virtual ~ cSatipServer ( ) ;
virtual int Compare ( const cListObject & listObjectP ) const ;
void Use ( bool onOffP ) ;
bool Used ( void ) { return ! ! useCountM ; }
const char * Description ( ) { return * descriptionM ; }
const char * Address ( ) { return * addressM ; }
const char * Model ( void ) { return modelM ; }
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 ) ; }
int Cable ( ) { return Match ( eSatipModelTypeDVBC ) ? ( Match ( eSatipModelTypeDVBT2 ) ? modelCountM [ eSatipModuleDVBT2 ] : modelCountM [ eSatipModuleDVBT ] ) : 0 ; } // an ugly hack
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 ) ;
cSatipServer * Find ( int sourceP , int systemP ) ;
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