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

Fixed the device discovery.

This commit is contained in:
Rolf Ahrenberg 2014-04-24 20:04:43 +03:00
parent 78ef582bea
commit fbbfdfab2b
7 changed files with 40 additions and 24 deletions

View File

@ -50,3 +50,7 @@ VDR Plugin 'satip' Revision History
2014-04-20: Version 0.3.0 2014-04-20: Version 0.3.0
- Tweaked the pid update mechanism. - Tweaked the pid update mechanism.
2014-04-27: Version 0.3.1
- Fixed the device discovery.

View File

@ -179,7 +179,7 @@ void cSatipDiscover::Read(void)
int len = socketM->Read(buf, eProbeBufferSize); int len = socketM->Read(buf, eProbeBufferSize);
if (len > 0) { if (len > 0) {
//debug("cSatipDiscover::%s(): len=%d", __FUNCTION__, len); //debug("cSatipDiscover::%s(): len=%d", __FUNCTION__, len);
bool status = false; bool status = false, valid = false;
char *s, *p = reinterpret_cast<char *>(buf), *location = NULL; char *s, *p = reinterpret_cast<char *>(buf), *location = NULL;
char *r = strtok_r(p, "\r\n", &s); char *r = strtok_r(p, "\r\n", &s);
while (r) { while (r) {
@ -187,18 +187,30 @@ void cSatipDiscover::Read(void)
// Check the status code // Check the status code
// HTTP/1.1 200 OK // HTTP/1.1 200 OK
if (!status && startswith(r, "HTTP/1.1 200 OK")) { if (!status && startswith(r, "HTTP/1.1 200 OK")) {
status = true; status = true;
} }
// Check the location data if (status) {
// LOCATION: http://192.168.0.115:8888/octonet.xml // Check the location data
if (status && startswith(r, "LOCATION:")) { // LOCATION: http://192.168.0.115:8888/octonet.xml
location = compactspace(r + 9); if (startswith(r, "LOCATION:")) {
debug("cSatipDiscover::%s(): location='%s'", __FUNCTION__, location); location = compactspace(r + 9);
break; 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); r = strtok_r(NULL, "\r\n", &s);
} }
if (handleM && !isempty(location)) { if (handleM && valid && !isempty(location)) {
long rc = 0; long rc = 0;
CURLcode res = CURLE_OK; CURLcode res = CURLE_OK;
#ifdef DEBUG #ifdef DEBUG

View File

@ -5,10 +5,10 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-satip 0.3.0\n" "Project-Id-Version: vdr-satip 0.3.1\n"
"Report-Msgid-Bugs-To: <see README>\n" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-04-20 04:20+0200\n" "POT-Creation-Date: 2014-04-27 04:27+0200\n"
"PO-Revision-Date: 2014-04-20 04:20+0200\n" "PO-Revision-Date: 2014-04-27 04:27+0200\n"
"Last-Translator: Gabriel Bonich <gbonich@gmail.com>\n" "Last-Translator: Gabriel Bonich <gbonich@gmail.com>\n"
"Language-Team: Catalan <vdr@linuxtv.org>\n" "Language-Team: Catalan <vdr@linuxtv.org>\n"
"Language: ca\n" "Language: ca\n"

View File

@ -5,10 +5,10 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-satip 0.3.0\n" "Project-Id-Version: vdr-satip 0.3.1\n"
"Report-Msgid-Bugs-To: <see README>\n" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-04-20 04:20+0200\n" "POT-Creation-Date: 2014-04-27 04:27+0200\n"
"PO-Revision-Date: 2014-04-20 04:20+0200\n" "PO-Revision-Date: 2014-04-27 04:27+0200\n"
"Last-Translator: Frank Neumann <fnu@yavdr.org>\n" "Last-Translator: Frank Neumann <fnu@yavdr.org>\n"
"Language-Team: German <vdr@linuxtv.org>\n" "Language-Team: German <vdr@linuxtv.org>\n"
"Language: de\n" "Language: de\n"

View File

@ -5,10 +5,10 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-satip 0.3.0\n" "Project-Id-Version: vdr-satip 0.3.1\n"
"Report-Msgid-Bugs-To: <see README>\n" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-04-20 04:20+0200\n" "POT-Creation-Date: 2014-04-27 04:27+0200\n"
"PO-Revision-Date: 2014-04-20 04:20+0200\n" "PO-Revision-Date: 2014-04-27 04:27+0200\n"
"Last-Translator: Gabriel Bonich <gbonich@gmail.com>\n" "Last-Translator: Gabriel Bonich <gbonich@gmail.com>\n"
"Language-Team: Spanish <vdr@linuxtv.org>\n" "Language-Team: Spanish <vdr@linuxtv.org>\n"
"Language: es\n" "Language: es\n"

View File

@ -5,10 +5,10 @@
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: vdr-satip 0.3.0\n" "Project-Id-Version: vdr-satip 0.3.1\n"
"Report-Msgid-Bugs-To: <see README>\n" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2014-04-20 04:20+0200\n" "POT-Creation-Date: 2014-04-27 04:27+0200\n"
"PO-Revision-Date: 2014-04-20 04:20+0200\n" "PO-Revision-Date: 2014-04-27 04:27+0200\n"
"Last-Translator: Rolf Ahrenberg\n" "Last-Translator: Rolf Ahrenberg\n"
"Language-Team: Finnish <vdr@linuxtv.org>\n" "Language-Team: Finnish <vdr@linuxtv.org>\n"
"Language: fi\n" "Language: fi\n"

View File

@ -25,7 +25,7 @@
#define GITVERSION "" #define GITVERSION ""
#endif #endif
const char VERSION[] = "0.3.0" GITVERSION; const char VERSION[] = "0.3.1" GITVERSION;
static const char DESCRIPTION[] = trNOOP("SAT>IP Devices"); static const char DESCRIPTION[] = trNOOP("SAT>IP Devices");
class cPluginSatip : public cPlugin { class cPluginSatip : public cPlugin {