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 (serversP) {
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
instanceS->Activate();
@ -88,7 +88,7 @@ size_t cSatipDiscover::WriteCallback(char *ptrP, size_t sizeP, size_t nmembP, vo
}
#endif
SATIP_CURL_EASY_GETINFO(obj->handleM, CURLINFO_PRIMARY_IP, &addr);
obj->AddServer(addr, desc, model);
obj->AddServer(addr, model, desc);
}
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);
if (serversM) {
cSatipServer *tmp = new cSatipServer(addrP, descP, modelP);
cSatipServer *tmp = new cSatipServer(addrP, modelP, descP);
// Validate against existing servers
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);
}
else

View File

@ -22,13 +22,13 @@ private:
cString descriptionM;
cString modelM;
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 *Description(void) { return *descriptionM; }
const char *Model(void) { return *modelM; }
const char *Description(void) { return *descriptionM; }
};
class cSatipDiscoverServers : public cList<cSatipDiscoverServer> {
@ -59,7 +59,7 @@ private:
void Janitor(void);
void Probe(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
cSatipDiscover();
// 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);
if (!serversM)
serversM = new cSatipDiscoverServers();
serversM->Add(new cSatipDiscoverServer(*serverAddr, *serverDescription, *serverModel));
serversM->Add(new cSatipDiscoverServer(*serverAddr, *serverModel, *serverDescription));
}
++n;
r = strtok_r(NULL, ";", &s);

View File

@ -12,10 +12,10 @@
// --- 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),
descriptionM(descriptionP),
modelM(modelP),
descriptionM(descriptionP),
modelTypeM(eSatipModelTypeNone),
quirkM(eSatipQuirkNone),
useCountM(0),

View File

@ -20,8 +20,8 @@ private:
eSatipModuleCount
};
cString addressM;
cString descriptionM;
cString modelM;
cString descriptionM;
int modelCountM[eSatipModuleCount];
int modelTypeM;
int quirkM;
@ -46,16 +46,16 @@ public:
eSatipModelTypeDVBC = 0x08,
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 int Compare(const cListObject &listObjectP) const;
void Use(bool onOffP);
void SetTransponder(const int transponderP) { transponderM = transponderP; }
int Transponder(void) { return transponderM; }
bool Used(void) { return !!useCountM; }
const char *Description() { return *descriptionM; }
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); }
int ModelType(void) { return modelTypeM; }
bool Match(int modelP) { return ((modelP & eSatipModelTypeMask) & modelTypeM); }