X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/ddc3964ed95d01e72229dc9af968a327cd84e56c..17b07b8ab4f698dfbef69fcf77b8f8d86c440f39:/lib/service/service.cpp diff --git a/lib/service/service.cpp b/lib/service/service.cpp index d18b8eee..a490c3d7 100644 --- a/lib/service/service.cpp +++ b/lib/service/service.cpp @@ -7,8 +7,8 @@ eServiceReference::eServiceReference(const std::string &string) { const char *c=string.c_str(); - int pathl=-1; - + int pathl=0; + if ( sscanf(c, "%d:%d:%x:%x:%x:%x:%x:%x:%x:%x:%n", &type, &flags, &data[0], &data[1], &data[2], &data[3], &data[4], &data[5], &data[6], &data[7], &pathl) < 8 ) { memset( data, 0, sizeof(data) ); @@ -17,7 +17,19 @@ eServiceReference::eServiceReference(const std::string &string) } if (pathl) - path=c+pathl; + { + const char *pathstr = c+pathl; + const char *namestr = strchr(pathstr, ':'); + if (namestr) + { + if (pathstr != namestr) + path.assign(pathstr, namestr-pathstr); + if (*(namestr+1)) + name=namestr+1; + } + else + path=pathstr; + } } std::string eServiceReference::toString() const @@ -27,10 +39,10 @@ std::string eServiceReference::toString() const ret += ":"; ret += getNum(flags); for (unsigned int i=0; i return i->second->list(ref, ptr); } +RESULT eServiceCenter::info(const eServiceReference &ref, ePtr &ptr) +{ + std::map >::iterator i = handler.find(ref.type); + if (i == handler.end()) + { + ptr = 0; + return -1; + } + return i->second->info(ref, ptr); +} + +RESULT eServiceCenter::offlineOperations(const eServiceReference &ref, ePtr &ptr) +{ + std::map >::iterator i = handler.find(ref.type); + if (i == handler.end()) + { + ptr = 0; + return -1; + } + return i->second->offlineOperations(ref, ptr); +} + RESULT eServiceCenter::addServiceFactory(int id, iServiceHandler *hnd) { handler.insert(std::pair >(id, hnd)); @@ -102,4 +136,55 @@ RESULT eServiceCenter::removeServiceFactory(int id) return 0; } + /* default handlers */ +RESULT iServiceHandler::info(const eServiceReference &, ePtr &ptr) +{ + ptr = 0; + return -1; +} + +#include + +RESULT iStaticServiceInformation::getEvent(const eServiceReference &ref, ePtr &evt, time_t start_time) +{ + evt = 0; + return -1; +} + +int iStaticServiceInformation::getLength(const eServiceReference &ref) +{ + return -1; +} + +bool iStaticServiceInformation::isPlayable(const eServiceReference &ref, const eServiceReference &ignore) +{ + return true; +} + +RESULT iServiceInformation::getEvent(ePtr &evt, int m_nownext) +{ + evt = 0; + return -1; +} + +int iStaticServiceInformation::getInfo(const eServiceReference &ref, int w) +{ + return -1; +} + +std::string iStaticServiceInformation::getInfoString(const eServiceReference &ref, int w) +{ + return ""; +} + +int iServiceInformation::getInfo(int w) +{ + return -1; +} + +std::string iServiceInformation::getInfoString(int w) +{ + return ""; +} + eAutoInitPtr init_eServiceCenter(eAutoInitNumbers::service, "eServiceCenter");