From fbbfdfab2bd79d91716bde5760a8ab82cf4ce899 Mon Sep 17 00:00:00 2001 From: Rolf Ahrenberg Date: Thu, 24 Apr 2014 20:04:43 +0300 Subject: [PATCH] Fixed the device discovery. --- HISTORY | 4 ++++ discover.c | 34 +++++++++++++++++++++++----------- po/ca_ES.po | 6 +++--- po/de_DE.po | 6 +++--- po/es_ES.po | 6 +++--- po/fi_FI.po | 6 +++--- satip.c | 2 +- 7 files changed, 40 insertions(+), 24 deletions(-) diff --git a/HISTORY b/HISTORY index 7a52685..f6e7ea6 100644 --- a/HISTORY +++ b/HISTORY @@ -50,3 +50,7 @@ VDR Plugin 'satip' Revision History 2014-04-20: Version 0.3.0 - Tweaked the pid update mechanism. + +2014-04-27: Version 0.3.1 + +- Fixed the device discovery. diff --git a/discover.c b/discover.c index fcaa9d0..84654a0 100644 --- a/discover.c +++ b/discover.c @@ -179,7 +179,7 @@ void cSatipDiscover::Read(void) int len = socketM->Read(buf, eProbeBufferSize); if (len > 0) { //debug("cSatipDiscover::%s(): len=%d", __FUNCTION__, len); - bool status = false; + bool status = false, valid = false; char *s, *p = reinterpret_cast(buf), *location = NULL; char *r = strtok_r(p, "\r\n", &s); while (r) { @@ -187,18 +187,30 @@ void cSatipDiscover::Read(void) // Check the status code // HTTP/1.1 200 OK if (!status && startswith(r, "HTTP/1.1 200 OK")) { - status = true; - } - // Check the location data - // LOCATION: http://192.168.0.115:8888/octonet.xml - if (status && startswith(r, "LOCATION:")) { - location = compactspace(r + 9); - debug("cSatipDiscover::%s(): location='%s'", __FUNCTION__, location); - break; - } + status = true; + } + if (status) { + // Check the location data + // LOCATION: http://192.168.0.115:8888/octonet.xml + if (startswith(r, "LOCATION:")) { + location = compactspace(r + 9); + debug("cSatipDiscover::%s(): location='%s'", __FUNCTION__, location); + } + // Check the source type + // ST: urn:ses-com:device:SatIPServer:1 + else if (startswith(r, "ST:")) { + char *st = compactspace(r + 3); + if (strstr(st, "urn:ses-com:device:SatIPServer:1")) + valid = true; + debug("cSatipDiscover::%s(): st='%s'", __FUNCTION__, st); + } + // Check whether all the required data is found + if (valid && !isempty(location)) + break; + } r = strtok_r(NULL, "\r\n", &s); } - if (handleM && !isempty(location)) { + if (handleM && valid && !isempty(location)) { long rc = 0; CURLcode res = CURLE_OK; #ifdef DEBUG diff --git a/po/ca_ES.po b/po/ca_ES.po index e5b29a6..7dbb4d8 100644 --- a/po/ca_ES.po +++ b/po/ca_ES.po @@ -5,10 +5,10 @@ # msgid "" msgstr "" -"Project-Id-Version: vdr-satip 0.3.0\n" +"Project-Id-Version: vdr-satip 0.3.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-04-20 04:20+0200\n" -"PO-Revision-Date: 2014-04-20 04:20+0200\n" +"POT-Creation-Date: 2014-04-27 04:27+0200\n" +"PO-Revision-Date: 2014-04-27 04:27+0200\n" "Last-Translator: Gabriel Bonich \n" "Language-Team: Catalan \n" "Language: ca\n" diff --git a/po/de_DE.po b/po/de_DE.po index ecc118e..bf0ce9e 100644 --- a/po/de_DE.po +++ b/po/de_DE.po @@ -5,10 +5,10 @@ # msgid "" msgstr "" -"Project-Id-Version: vdr-satip 0.3.0\n" +"Project-Id-Version: vdr-satip 0.3.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-04-20 04:20+0200\n" -"PO-Revision-Date: 2014-04-20 04:20+0200\n" +"POT-Creation-Date: 2014-04-27 04:27+0200\n" +"PO-Revision-Date: 2014-04-27 04:27+0200\n" "Last-Translator: Frank Neumann \n" "Language-Team: German \n" "Language: de\n" diff --git a/po/es_ES.po b/po/es_ES.po index f5ba798..240be3d 100644 --- a/po/es_ES.po +++ b/po/es_ES.po @@ -5,10 +5,10 @@ # msgid "" msgstr "" -"Project-Id-Version: vdr-satip 0.3.0\n" +"Project-Id-Version: vdr-satip 0.3.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-04-20 04:20+0200\n" -"PO-Revision-Date: 2014-04-20 04:20+0200\n" +"POT-Creation-Date: 2014-04-27 04:27+0200\n" +"PO-Revision-Date: 2014-04-27 04:27+0200\n" "Last-Translator: Gabriel Bonich \n" "Language-Team: Spanish \n" "Language: es\n" diff --git a/po/fi_FI.po b/po/fi_FI.po index 2016a41..8a56ade 100644 --- a/po/fi_FI.po +++ b/po/fi_FI.po @@ -5,10 +5,10 @@ # msgid "" msgstr "" -"Project-Id-Version: vdr-satip 0.3.0\n" +"Project-Id-Version: vdr-satip 0.3.1\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2014-04-20 04:20+0200\n" -"PO-Revision-Date: 2014-04-20 04:20+0200\n" +"POT-Creation-Date: 2014-04-27 04:27+0200\n" +"PO-Revision-Date: 2014-04-27 04:27+0200\n" "Last-Translator: Rolf Ahrenberg\n" "Language-Team: Finnish \n" "Language: fi\n" diff --git a/satip.c b/satip.c index 8b4f038..38fa09f 100644 --- a/satip.c +++ b/satip.c @@ -25,7 +25,7 @@ #define GITVERSION "" #endif - const char VERSION[] = "0.3.0" GITVERSION; + const char VERSION[] = "0.3.1" GITVERSION; static const char DESCRIPTION[] = trNOOP("SAT>IP Devices"); class cPluginSatip : public cPlugin {