1
0
mirror of https://github.com/rofafor/vdr-plugin-satip.git synced 2023-10-10 13:37:42 +02:00

Tweaked internals and log messages to match SVDRP interface.

This commit is contained in:
Rolf Ahrenberg 2014-11-11 00:05:03 +02:00
parent 7110cee7a9
commit 45d0227d2b
5 changed files with 17 additions and 17 deletions

View File

@ -38,7 +38,7 @@ bool cSatipDiscover::Initialize(cSatipDiscoverServers *serversP)
if (instanceS) { if (instanceS) {
if (serversP) { if (serversP) {
for (cSatipDiscoverServer *s = serversP->First(); s; s = serversP->Next(s)) for (cSatipDiscoverServer *s = serversP->First(); s; s = serversP->Next(s))
instanceS->AddServer(s->IpAddress(), s->Description(), s->Model()); instanceS->AddServer(s->IpAddress(), s->Model(), s->Description());
} }
else else
instanceS->Activate(); instanceS->Activate();
@ -88,7 +88,7 @@ size_t cSatipDiscover::WriteCallback(char *ptrP, size_t sizeP, size_t nmembP, vo
} }
#endif #endif
SATIP_CURL_EASY_GETINFO(obj->handleM, CURLINFO_PRIMARY_IP, &addr); SATIP_CURL_EASY_GETINFO(obj->handleM, CURLINFO_PRIMARY_IP, &addr);
obj->AddServer(addr, desc, model); obj->AddServer(addr, model, desc);
} }
return len; return len;
@ -282,15 +282,15 @@ void cSatipDiscover::Read(void)
} }
} }
void cSatipDiscover::AddServer(const char *addrP, const char *descP, const char * modelP) void cSatipDiscover::AddServer(const char *addrP, const char *modelP, const char * descP)
{ {
debug("cSatipDiscover::%s(%s, %s, %s)", __FUNCTION__, addrP, descP, modelP); debug("cSatipDiscover::%s(%s, %s, %s)", __FUNCTION__, addrP, modelP, descP);
cMutexLock MutexLock(&mutexM); cMutexLock MutexLock(&mutexM);
if (serversM) { if (serversM) {
cSatipServer *tmp = new cSatipServer(addrP, descP, modelP); cSatipServer *tmp = new cSatipServer(addrP, modelP, descP);
// Validate against existing servers // Validate against existing servers
if (!serversM->Update(tmp)) { if (!serversM->Update(tmp)) {
info("Adding device %s (%s %s)", tmp->Description(), tmp->Address(), tmp->Model()); info("Adding device '%s|%s|%s'", tmp->Address(), tmp->Model(), tmp->Description());
serversM->Add(tmp); serversM->Add(tmp);
} }
else else

View File

@ -22,13 +22,13 @@ private:
cString descriptionM; cString descriptionM;
cString modelM; cString modelM;
public: public:
cSatipDiscoverServer(const char *ipAddressP, const char *descriptionP, const char *modelP) cSatipDiscoverServer(const char *ipAddressP, const char *modelP, const char *descriptionP)
{ {
ipAddressM = ipAddressP; descriptionM = descriptionP; modelM = modelP; ipAddressM = ipAddressP; modelM = modelP; descriptionM = descriptionP;
} }
const char *IpAddress(void) { return *ipAddressM; } const char *IpAddress(void) { return *ipAddressM; }
const char *Description(void) { return *descriptionM; }
const char *Model(void) { return *modelM; } const char *Model(void) { return *modelM; }
const char *Description(void) { return *descriptionM; }
}; };
class cSatipDiscoverServers : public cList<cSatipDiscoverServer> { class cSatipDiscoverServers : public cList<cSatipDiscoverServer> {
@ -59,7 +59,7 @@ private:
void Janitor(void); void Janitor(void);
void Probe(void); void Probe(void);
void Read(void); void Read(void);
void AddServer(const char *addrP, const char *descP, const char *modelP); void AddServer(const char *addrP, const char *modelP, const char *descP);
// constructor // constructor
cSatipDiscover(); cSatipDiscover();
// to prevent copy constructor and assignment // to prevent copy constructor and assignment

View File

@ -219,7 +219,7 @@ void cPluginSatip::ParseServer(const char *paramP)
debug("cPluginSatip::%s(): ipaddr=%s model=%s desc=%s", __FUNCTION__, *serverAddr, *serverModel, *serverDescription); debug("cPluginSatip::%s(): ipaddr=%s model=%s desc=%s", __FUNCTION__, *serverAddr, *serverModel, *serverDescription);
if (!serversM) if (!serversM)
serversM = new cSatipDiscoverServers(); serversM = new cSatipDiscoverServers();
serversM->Add(new cSatipDiscoverServer(*serverAddr, *serverDescription, *serverModel)); serversM->Add(new cSatipDiscoverServer(*serverAddr, *serverModel, *serverDescription));
} }
++n; ++n;
r = strtok_r(NULL, ";", &s); r = strtok_r(NULL, ";", &s);

View File

@ -12,10 +12,10 @@
// --- cSatipServer ----------------------------------------------------------- // --- cSatipServer -----------------------------------------------------------
cSatipServer::cSatipServer(const char *addressP, const char *descriptionP, const char *modelP) cSatipServer::cSatipServer(const char *addressP, const char *modelP, const char *descriptionP)
: addressM(addressP), : addressM(addressP),
descriptionM(descriptionP),
modelM(modelP), modelM(modelP),
descriptionM(descriptionP),
modelTypeM(eSatipModelTypeNone), modelTypeM(eSatipModelTypeNone),
quirkM(eSatipQuirkNone), quirkM(eSatipQuirkNone),
useCountM(0), useCountM(0),

View File

@ -20,8 +20,8 @@ private:
eSatipModuleCount eSatipModuleCount
}; };
cString addressM; cString addressM;
cString descriptionM;
cString modelM; cString modelM;
cString descriptionM;
int modelCountM[eSatipModuleCount]; int modelCountM[eSatipModuleCount];
int modelTypeM; int modelTypeM;
int quirkM; int quirkM;
@ -46,16 +46,16 @@ public:
eSatipModelTypeDVBC = 0x08, eSatipModelTypeDVBC = 0x08,
eSatipModelTypeMask = 0x0F eSatipModelTypeMask = 0x0F
}; };
cSatipServer(const char *addressP, const char *descriptionP, const char *modelP); cSatipServer(const char *addressP, const char *modelP, const char *descriptionP);
virtual ~cSatipServer(); virtual ~cSatipServer();
virtual int Compare(const cListObject &listObjectP) const; virtual int Compare(const cListObject &listObjectP) const;
void Use(bool onOffP); void Use(bool onOffP);
void SetTransponder(const int transponderP) { transponderM = transponderP; } void SetTransponder(const int transponderP) { transponderM = transponderP; }
int Transponder(void) { return transponderM; } int Transponder(void) { return transponderM; }
bool Used(void) { return !!useCountM; } bool Used(void) { return !!useCountM; }
const char *Description() { return *descriptionM; }
const char *Address() { return *addressM; } const char *Address() { return *addressM; }
const char *Model(void) { return modelM; } const char *Model(void) { return *modelM; }
const char *Description() { return *descriptionM; }
bool Quirk(int quirkP) { return ((quirkP & eSatipQuirkMask) & quirkM); } bool Quirk(int quirkP) { return ((quirkP & eSatipQuirkMask) & quirkM); }
int ModelType(void) { return modelTypeM; } int ModelType(void) { return modelTypeM; }
bool Match(int modelP) { return ((modelP & eSatipModelTypeMask) & modelTypeM); } bool Match(int modelP) { return ((modelP & eSatipModelTypeMask) & modelTypeM); }