lcd: fix inverted mode
[enigma2.git] / lib / service / service.cpp
index 6141516..3a59d44 100644 (file)
@@ -1,8 +1,10 @@
+#include <lib/base/eerror.h>
+#include <lib/base/estring.h>
 #include <lib/service/service.h>
 #include <lib/base/init_num.h>
 #include <lib/base/init.h>
 
 #include <lib/service/service.h>
 #include <lib/base/init_num.h>
 #include <lib/base/init.h>
 
-eServiceReference::eServiceReference(const eString &string)
+eServiceReference::eServiceReference(const std::string &string)
 {
        const char *c=string.c_str();
        int pathl=-1;
 {
        const char *c=string.c_str();
        int pathl=-1;
@@ -18,13 +20,16 @@ eServiceReference::eServiceReference(const eString &string)
                path=c+pathl;
 }
 
                path=c+pathl;
 }
 
-eString eServiceReference::toString() const
+std::string eServiceReference::toString() const
 {
 {
-       eString ret;
-       ret+=eString().sprintf("%d:", type);
-       ret+=eString().sprintf("%d", flags);
+       std::string ret;
+       ret += getNum(type);
+       ret += ":";
+       ret += getNum(flags);
        for (unsigned int i=0; i<sizeof(data)/sizeof(*data); ++i)
        for (unsigned int i=0; i<sizeof(data)/sizeof(*data); ++i)
-               ret+=":"+eString().sprintf("%x", data[i]);
+       {
+               ret+=":"+ getNum(data[i], 0x10);
+       }
        ret+=":"+path;
        return ret;
 }
        ret+=":"+path;
        return ret;
 }
@@ -32,7 +37,7 @@ eString eServiceReference::toString() const
 
 eServiceCenter *eServiceCenter::instance;
 
 
 eServiceCenter *eServiceCenter::instance;
 
-eServiceCenter::eServiceCenter(): ref(0)
+eServiceCenter::eServiceCenter()
 {
        if (!instance)
        {
 {
        if (!instance)
        {
@@ -85,6 +90,28 @@ RESULT eServiceCenter::list(const eServiceReference &ref, ePtr<iListableService>
        return i->second->list(ref, ptr);
 }
 
        return i->second->list(ref, ptr);
 }
 
+RESULT eServiceCenter::info(const eServiceReference &ref, ePtr<iStaticServiceInformation> &ptr)
+{
+       std::map<int,ePtr<iServiceHandler> >::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<iServiceOfflineOperations> &ptr)
+{
+       std::map<int,ePtr<iServiceHandler> >::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<int,ePtr<iServiceHandler> >(id, hnd));
 RESULT eServiceCenter::addServiceFactory(int id, iServiceHandler *hnd)
 {
        handler.insert(std::pair<int,ePtr<iServiceHandler> >(id, hnd));
@@ -97,4 +124,20 @@ RESULT eServiceCenter::removeServiceFactory(int id)
        return 0;
 }
 
        return 0;
 }
 
+       /* default handlers */
+RESULT iServiceHandler::info(const eServiceReference &, ePtr<iStaticServiceInformation> &ptr)
+{
+       ptr = 0;
+       return -1;
+}
+
+#include <lib/service/event.h>
+
+RESULT iServiceInformation::getEvent(ePtr<eServiceEvent> &evt, int m_nownext)
+{      
+       evt = 0;
+       return -1;
+}
+
+
 eAutoInitPtr<eServiceCenter> init_eServiceCenter(eAutoInitNumbers::service, "eServiceCenter");
 eAutoInitPtr<eServiceCenter> init_eServiceCenter(eAutoInitNumbers::service, "eServiceCenter");