From 45d0227d2bf1c47c7b9fae62bf2d7f95eebc7513 Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Tue, 11 Nov 2014 00:05:03 +0200 Subject: [PATCH] Tweaked internals and log messages to match SVDRP interface. --- discover.c | 12 ++++++------ discover.h | 8 ++++---- satip.c | 2 +- server.c | 4 ++-- server.h | 8 ++++---- 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/discover.c b/discover.c index 33b393d..795fa4b 100644 --- a/discover.c +++ b/discover.c @@ -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 diff --git a/discover.h b/discover.h index 29b63e2..d6d00bc 100644 --- a/discover.h +++ b/discover.h @@ -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 { @@ -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 diff --git a/satip.c b/satip.c index 959f2cc..c0847e9 100644 --- a/satip.c +++ b/satip.c @@ -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); diff --git a/server.c b/server.c index 4364a37..7783389 100644 --- a/server.c +++ b/server.c @@ -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), diff --git a/server.h b/server.h index 6845c55..317a42f 100644 --- a/server.h +++ b/server.h @@ -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); }