#include <lib/base/eerror.h>
#include <lib/base/estring.h>
+#include <lib/python/python.h>
#include <lib/service/service.h>
#include <lib/base/init_num.h>
#include <lib/base/init.h>
+#include <Python.h>
eServiceReference::eServiceReference(const std::string &string)
{
const char *c=string.c_str();
- int pathl=-1;
-
- 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 )
+ int pathl=0;
+
+ if (!string.length())
+ type = idInvalid;
+ else 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) );
eDebug("find old format eServiceReference string");
- sscanf(c, "%d:%d:%x:%x:%x:%x:%n", &type, &flags, &data[0], &data[1], &data[2], &data[3], &pathl);
+ if ( sscanf(c, "%d:%d:%x:%x:%x:%x:%n", &type, &flags, &data[0], &data[1], &data[2], &data[3], &pathl) < 2 )
+ type = idInvalid;
}
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
ret += ":";
ret += getNum(flags);
for (unsigned int i=0; i<sizeof(data)/sizeof(*data); ++i)
- {
ret+=":"+ getNum(data[i], 0x10);
- }
ret+=":"+path;
+ if (name.length())
+ ret+=":"+name;
return ret;
}
+std::string eServiceReference::toCompareString() const
+{
+ std::string ret;
+ ret += getNum(type);
+ ret += ":0";
+ for (unsigned int i=0; i<sizeof(data)/sizeof(*data); ++i)
+ ret+=":"+getNum(data[i], 0x10);
+ ret+=":"+path;
+ return ret;
+}
eServiceCenter *eServiceCenter::instance;
#include <lib/service/event.h>
+RESULT iStaticServiceInformation::getEvent(const eServiceReference &ref, ePtr<eServiceEvent> &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<eServiceEvent> &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 "";
+}
+
+PyObject* iServiceInformation::getInfoObject(int w)
+{
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+int iStaticServiceInformation::setInfo(const eServiceReference &ref, int w, int v)
+{
+ return -1;
+}
+
+int iStaticServiceInformation::setInfoString(const eServiceReference &ref, int w, const char *v)
+{
+ return -1;
+}
+
+int iServiceInformation::setInfo(int w, int v)
+{
+ return -1;
+}
+
+int iServiceInformation::setInfoString(int w, const char *v)
+{
+ return -1;
+}
eAutoInitPtr<eServiceCenter> init_eServiceCenter(eAutoInitNumbers::service, "eServiceCenter");