lcd: fix inverted mode
[enigma2.git] / lib / service / service.cpp
index 99199aa..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>
 
-eServiceReference::eServiceReference(const eString &string)
+eServiceReference::eServiceReference(const std::string &string)
 {
        const char *c=string.c_str();
        int pathl=-1;
@@ -18,13 +20,16 @@ eServiceReference::eServiceReference(const eString &string)
                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)
-               ret+=":"+eString().sprintf("%x", data[i]);
+       {
+               ret+=":"+ getNum(data[i], 0x10);
+       }
        ret+=":"+path;
        return ret;
 }
@@ -35,13 +40,19 @@ eServiceCenter *eServiceCenter::instance;
 eServiceCenter::eServiceCenter()
 {
        if (!instance)
+       {
+               eDebug("settings instance.");
                instance = this;
+       }
 }
 
 eServiceCenter::~eServiceCenter()
 {
        if (instance == this)
+       {
+               eDebug("clear instance");
                instance = 0;
+       }
 }
 
 DEFINE_REF(eServiceCenter);
@@ -79,6 +90,28 @@ RESULT eServiceCenter::list(const eServiceReference &ref, ePtr<iListableService>
        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));
@@ -91,4 +124,20 @@ RESULT eServiceCenter::removeServiceFactory(int id)
        return 0;
 }
 
-eAutoInitP0<eServiceCenter> init_eServiceCenter(eAutoInitNumbers::service, "eServiceCenter");
+       /* 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");