use eDebug instead of printf
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Thu, 24 Aug 2006 20:21:43 +0000 (20:21 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Thu, 24 Aug 2006 20:21:43 +0000 (20:21 +0000)
lib/dvb_ci/dvbci.cpp
lib/dvb_ci/dvbci_appmgr.cpp
lib/dvb_ci/dvbci_camgr.cpp
lib/dvb_ci/dvbci_datetimemgr.cpp
lib/dvb_ci/dvbci_mmi.cpp
lib/dvb_ci/dvbci_resmgr.cpp
lib/dvb_ci/dvbci_session.cpp
lib/dvb_ci/dvbci_ui.cpp

index 632ab34..d95f683 100644 (file)
@@ -62,7 +62,7 @@ eDVBCISlot *eDVBCIInterfaces::getSlot(int slotid)
                if(i->getSlotID() == slotid)
                        return i;
 
                if(i->getSlotID() == slotid)
                        return i;
 
-       printf("FIXME: request for unknown slot\n");
+       eDebug("FIXME: request for unknown slot");
                        
        return 0;
 }
                        
        return 0;
 }
@@ -422,10 +422,10 @@ int eDVBCISlot::send(const unsigned char *data, size_t len)
 {
        int res=0;
        //int i;
 {
        int res=0;
        //int i;
-       //printf("< ");
+       //eDebugNoNewLine("< ");
        //for(i=0;i<len;i++)
        //for(i=0;i<len;i++)
-       //      printf("%02x ",data[i]);
-       //printf("\n");
+       //      eDebugNoNewLine("%02x ",data[i]);
+       //eDebug("");
 
        if (sendqueue.empty())
                res = ::write(fd, data, len);
 
        if (sendqueue.empty())
                res = ::write(fd, data, len);
@@ -446,7 +446,7 @@ void eDVBCISlot::data(int what)
        if(what == eSocketNotifier::Priority) {
                if(state != stateRemoved) {
                        state = stateRemoved;
        if(what == eSocketNotifier::Priority) {
                if(state != stateRemoved) {
                        state = stateRemoved;
-                       printf("ci removed\n");
+                       eDebug("ci removed");
                        while(sendqueue.size())
                        {
                                delete [] sendqueue.top().data;
                        while(sendqueue.size())
                        {
                                delete [] sendqueue.top().data;
@@ -477,10 +477,10 @@ void eDVBCISlot::data(int what)
                r = ::read(fd, data, 4096);
                if(r > 0) {
 //                     int i;
                r = ::read(fd, data, 4096);
                if(r > 0) {
 //                     int i;
-//                     printf("> ");
+//                     eDebugNoNewLine("> ");
 //                     for(i=0;i<r;i++)
 //                     for(i=0;i<r;i++)
-//                             printf("%02x ",data[i]);
-//                     printf("\n");
+//                             eDebugNoNewLine("%02x ",data[i]);
+//                     eDebug("");
                        eDVBCISession::receiveData(this, data, r);
                        eDVBCISession::pollAll();
                        return;
                        eDVBCISession::receiveData(this, data, r);
                        eDVBCISession::pollAll();
                        return;
@@ -559,7 +559,7 @@ int eDVBCISlot::getSlotID()
 
 int eDVBCISlot::reset()
 {
 
 int eDVBCISlot::reset()
 {
-       printf("edvbcislot: reset requested\n");
+       eDebug("edvbcislot: reset requested");
 
        if (state == stateInvalid)
        {
 
        if (state == stateInvalid)
        {
@@ -582,7 +582,7 @@ int eDVBCISlot::reset()
 
 int eDVBCISlot::startMMI()
 {
 
 int eDVBCISlot::startMMI()
 {
-       printf("edvbcislot: startMMI()\n");
+       eDebug("edvbcislot: startMMI()");
        
        if(application_manager)
                application_manager->startMMI();
        
        if(application_manager)
                application_manager->startMMI();
@@ -592,7 +592,7 @@ int eDVBCISlot::startMMI()
 
 int eDVBCISlot::stopMMI()
 {
 
 int eDVBCISlot::stopMMI()
 {
-       printf("edvbcislot: stopMMI()\n");
+       eDebug("edvbcislot: stopMMI()");
 
        if(mmi_session)
                mmi_session->stopMMI();
 
        if(mmi_session)
                mmi_session->stopMMI();
@@ -602,7 +602,7 @@ int eDVBCISlot::stopMMI()
 
 int eDVBCISlot::answerText(int answer)
 {
 
 int eDVBCISlot::answerText(int answer)
 {
-       printf("edvbcislot: answerText(%d)\n", answer);
+       eDebug("edvbcislot: answerText(%d)", answer);
 
        if(mmi_session)
                mmi_session->answerText(answer);
 
        if(mmi_session)
                mmi_session->answerText(answer);
@@ -620,7 +620,7 @@ int eDVBCISlot::getMMIState()
 
 int eDVBCISlot::answerEnq(char *value)
 {
 
 int eDVBCISlot::answerEnq(char *value)
 {
-       printf("edvbcislot: answerENQ(%s)\n", value);
+       eDebug("edvbcislot: answerENQ(%s)", value);
 
        if(mmi_session)
                mmi_session->answerEnq(value);
 
        if(mmi_session)
                mmi_session->answerEnq(value);
@@ -630,7 +630,7 @@ int eDVBCISlot::answerEnq(char *value)
 
 int eDVBCISlot::cancelEnq()
 {
 
 int eDVBCISlot::cancelEnq()
 {
-       printf("edvbcislot: cancelENQ\n");
+       eDebug("edvbcislot: cancelENQ");
 
        if(mmi_session)
                mmi_session->cancelEnq();
 
        if(mmi_session)
                mmi_session->cancelEnq();
@@ -740,20 +740,20 @@ void eDVBCISlot::removeService(uint16_t program_number)
 
 int eDVBCISlot::enableTS(int enable, int tuner)
 {
 
 int eDVBCISlot::enableTS(int enable, int tuner)
 {
-//     printf("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n");
-//     printf("eDVBCISlot::enableTS(%d %d)\n", enable, tuner);
+//     eDebug("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
+//     eDebug("eDVBCISlot::enableTS(%d %d)", enable, tuner);
 
        FILE *input0, *input1, *ci;
        if((input0 = fopen("/proc/stb/tsmux/input0", "wb")) == NULL) {
 
        FILE *input0, *input1, *ci;
        if((input0 = fopen("/proc/stb/tsmux/input0", "wb")) == NULL) {
-               printf("cannot open /proc/stb/tsmux/input0\n");
+               eDebug("cannot open /proc/stb/tsmux/input0");
                return 0;
        }
        if((input1 = fopen("/proc/stb/tsmux/input1", "wb")) == NULL) {
                return 0;
        }
        if((input1 = fopen("/proc/stb/tsmux/input1", "wb")) == NULL) {
-               printf("cannot open /proc/stb/tsmux/input1\n");
+               eDebug("cannot open /proc/stb/tsmux/input1");
                return 0;
        }
        if((ci = fopen("/proc/stb/tsmux/input2", "wb")) == NULL) {
                return 0;
        }
        if((ci = fopen("/proc/stb/tsmux/input2", "wb")) == NULL) {
-               printf("cannot open /proc/stb/tsmux/input2\n");
+               eDebug("cannot open /proc/stb/tsmux/input2");
                return 0;
        }
 
                return 0;
        }
 
index f815973..b3e9ca1 100644 (file)
@@ -1,5 +1,6 @@
 /* DVB CI Application Manager */
 
 /* DVB CI Application Manager */
 
+#include <lib/base/eerror.h>
 #include <lib/dvb_ci/dvbci_appmgr.h>
 #include <lib/dvb_ci/dvbci_ui.h>
 
 #include <lib/dvb_ci/dvbci_appmgr.h>
 #include <lib/dvb_ci/dvbci_ui.h>
 
@@ -16,10 +17,10 @@ eDVBCIApplicationManagerSession::~eDVBCIApplicationManagerSession()
 
 int eDVBCIApplicationManagerSession::receivedAPDU(const unsigned char *tag,const void *data, int len)
 {
 
 int eDVBCIApplicationManagerSession::receivedAPDU(const unsigned char *tag,const void *data, int len)
 {
-       printf("SESSION(%d)/APP %02x %02x %02x: ", session_nb, tag[0], tag[1], tag[2]);
+       eDebugNoNewLine("SESSION(%d)/APP %02x %02x %02x: ", session_nb, tag[0], tag[1], tag[2]);
        for (int i=0; i<len; i++)
        for (int i=0; i<len; i++)
-               printf("%02x ", ((const unsigned char*)data)[i]);
-       printf("\n");
+               eDebugNoNewLine("%02x ", ((const unsigned char*)data)[i]);
+       eDebug("");
 
        if ((tag[0]==0x9f) && (tag[1]==0x80))
        {
 
        if ((tag[0]==0x9f) && (tag[1]==0x80))
        {
@@ -28,24 +29,24 @@ int eDVBCIApplicationManagerSession::receivedAPDU(const unsigned char *tag,const
                case 0x21:
                {
                        int dl;
                case 0x21:
                {
                        int dl;
-                       printf("application info:\n");
-                       printf("  len: %d\n", len);
-                       printf("  application_type: %d\n", ((unsigned char*)data)[0]);
-                       printf("  application_manufacturer: %02x %02x\n", ((unsigned char*)data)[2], ((unsigned char*)data)[1]);
-                       printf("  manufacturer_code: %02x %02x\n", ((unsigned char*)data)[4],((unsigned char*)data)[3]);
-                       printf("  menu string: ");
+                       eDebug("application info:");
+                       eDebug("  len: %d", len);
+                       eDebug("  application_type: %d", ((unsigned char*)data)[0]);
+                       eDebug("  application_manufacturer: %02x %02x", ((unsigned char*)data)[2], ((unsigned char*)data)[1]);
+                       eDebug("  manufacturer_code: %02x %02x", ((unsigned char*)data)[4],((unsigned char*)data)[3]);
+                       eDebugNoNewLine("  menu string: ");
                        dl=((unsigned char*)data)[5];
                        if ((dl + 6) > len)
                        {
                        dl=((unsigned char*)data)[5];
                        if ((dl + 6) > len)
                        {
-                               printf("warning, invalid length (%d vs %d)\n", dl+6, len);
+                               eDebug("warning, invalid length (%d vs %d)", dl+6, len);
                                dl=len-6;
                        }
                        char str[dl + 1];
                        memcpy(str, ((char*)data) + 6, dl);
                        str[dl] = '\0';
                        for (int i = 0; i < dl; ++i)
                                dl=len-6;
                        }
                        char str[dl + 1];
                        memcpy(str, ((char*)data) + 6, dl);
                        str[dl] = '\0';
                        for (int i = 0; i < dl; ++i)
-                               printf("%c", ((unsigned char*)data)[i+6]);
-                       printf("\n");
+                               eDebugNoNewLine("%c", ((unsigned char*)data)[i+6]);
+                       eDebug("");
 
                        eDVBCI_UI::getInstance()->setAppName(slot->getSlotID(), str);
 
 
                        eDVBCI_UI::getInstance()->setAppName(slot->getSlotID(), str);
 
@@ -53,7 +54,7 @@ int eDVBCIApplicationManagerSession::receivedAPDU(const unsigned char *tag,const
                        break;
                }
                default:
                        break;
                }
                default:
-                       printf("unknown APDU tag 9F 80 %02x\n", tag[2]);
+                       eDebug("unknown APDU tag 9F 80 %02x", tag[2]);
                        break;
                }
        }
                        break;
                }
        }
@@ -72,11 +73,11 @@ int eDVBCIApplicationManagerSession::doAction()
     return 1;
   }
   case stateFinal:
     return 1;
   }
   case stateFinal:
-    printf("in final state.\n");
+    eDebug("in final state.");
                wantmenu = 0;
     if (wantmenu)
     {
                wantmenu = 0;
     if (wantmenu)
     {
-      printf("wantmenu: sending Tenter_menu\n");
+      eDebug("wantmenu: sending Tenter_menu");
       const unsigned char tag[3]={0x9F, 0x80, 0x22};  // Tenter_menu
       sendAPDU(tag);
       wantmenu=0;
       const unsigned char tag[3]={0x9F, 0x80, 0x22};  // Tenter_menu
       sendAPDU(tag);
       wantmenu=0;
@@ -90,7 +91,7 @@ int eDVBCIApplicationManagerSession::doAction()
 
 int eDVBCIApplicationManagerSession::startMMI()
 {
 
 int eDVBCIApplicationManagerSession::startMMI()
 {
-       printf("in appmanager -> startmmi()\n");
+       eDebug("in appmanager -> startmmi()");
        const unsigned char tag[3]={0x9F, 0x80, 0x22};  // Tenter_menu
        sendAPDU(tag);
        return 0;
        const unsigned char tag[3]={0x9F, 0x80, 0x22};  // Tenter_menu
        sendAPDU(tag);
        return 0;
index ef69ed4..42317b3 100644 (file)
@@ -1,5 +1,6 @@
 /* DVB CI CA Manager */
 
 /* DVB CI CA Manager */
 
+#include <lib/base/eerror.h>
 #include <lib/dvb_ci/dvbci_camgr.h>
 
 eDVBCICAManagerSession::eDVBCICAManagerSession(eDVBCISlot *tslot)
 #include <lib/dvb_ci/dvbci_camgr.h>
 
 eDVBCICAManagerSession::eDVBCICAManagerSession(eDVBCISlot *tslot)
@@ -15,28 +16,28 @@ eDVBCICAManagerSession::~eDVBCICAManagerSession()
 
 int eDVBCICAManagerSession::receivedAPDU(const unsigned char *tag, const void *data, int len)
 {
 
 int eDVBCICAManagerSession::receivedAPDU(const unsigned char *tag, const void *data, int len)
 {
-       printf("SESSION(%d)/CA %02x %02x %02x: ", session_nb, tag[0], tag[1],tag[2]);
+       eDebugNoNewLine("SESSION(%d)/CA %02x %02x %02x: ", session_nb, tag[0], tag[1],tag[2]);
        for (int i=0; i<len; i++)
        for (int i=0; i<len; i++)
-               printf("%02x ", ((const unsigned char*)data)[i]);
-       printf("\n");
+               eDebugNoNewLine("%02x ", ((const unsigned char*)data)[i]);
+       eDebug("");
 
        if ((tag[0]==0x9f) && (tag[1]==0x80))
        {
                switch (tag[2])
                {
                case 0x31:
 
        if ((tag[0]==0x9f) && (tag[1]==0x80))
        {
                switch (tag[2])
                {
                case 0x31:
-                       printf("ca info:\n");
+                       eDebug("ca info:");
                        for (int i=0; i<len; i+=2)
                        {
                        for (int i=0; i<len; i+=2)
                        {
-                               printf("%04x ", (((const unsigned char*)data)[i]<<8)|(((const unsigned char*)data)[i+1]));
+                               eDebugNoNewLine("%04x ", (((const unsigned char*)data)[i]<<8)|(((const unsigned char*)data)[i+1]));
                                caids.push_back((((const unsigned char*)data)[i]<<8)|(((const unsigned char*)data)[i+1]));
                        }
                        std::sort(caids.begin(), caids.end());
                                caids.push_back((((const unsigned char*)data)[i]<<8)|(((const unsigned char*)data)[i+1]));
                        }
                        std::sort(caids.begin(), caids.end());
-                       printf("\n");
+                       eDebug("");
                        eDVBCIInterfaces::getInstance()->recheckPMTHandlers();
                        break;
                default:
                        eDVBCIInterfaces::getInstance()->recheckPMTHandlers();
                        break;
                default:
-                       printf("unknown APDU tag 9F 80 %02x\n", tag[2]);
+                       eDebug("unknown APDU tag 9F 80 %02x", tag[2]);
                        break;
                }
        }
                        break;
                }
        }
@@ -55,7 +56,7 @@ int eDVBCICAManagerSession::doAction()
                return 0;
        }
        case stateFinal:
                return 0;
        }
        case stateFinal:
-               printf("stateFinal und action! kann doch garnicht sein ;)\n");
+               eDebug("stateFinal und action! kann doch garnicht sein ;)");
        default:
                return 0;
        }
        default:
                return 0;
        }
index 5d2c61d..f2b8a5c 100644 (file)
@@ -1,13 +1,14 @@
 /* DVB CI DateTime Manager */
 
 /* DVB CI DateTime Manager */
 
+#include <lib/base/eerror.h>
 #include <lib/dvb_ci/dvbci_datetimemgr.h>
 
 int eDVBCIDateTimeSession::receivedAPDU(const unsigned char *tag,const void *data, int len)
 {
 #include <lib/dvb_ci/dvbci_datetimemgr.h>
 
 int eDVBCIDateTimeSession::receivedAPDU(const unsigned char *tag,const void *data, int len)
 {
-       printf("SESSION(%d)/DATETIME %02x %02x %02x: ", session_nb, tag[0],tag[1], tag[2]);
+       eDebugNoNewLine("SESSION(%d)/DATETIME %02x %02x %02x: ", session_nb, tag[0],tag[1], tag[2]);
        for (int i=0; i<len; i++)
        for (int i=0; i<len; i++)
-               printf("%02x ", ((const unsigned char*)data)[i]);
-       printf("\n");
+               eDebugNoNewLine("%02x ", ((const unsigned char*)data)[i]);
+       eDebug("");
 
        if ((tag[0]==0x9f) && (tag[1]==0x84))
        {
 
        if ((tag[0]==0x9f) && (tag[1]==0x84))
        {
@@ -18,7 +19,7 @@ int eDVBCIDateTimeSession::receivedAPDU(const unsigned char *tag,const void *dat
                        return 1;
                        break;
                default:
                        return 1;
                        break;
                default:
-                       printf("unknown APDU tag 9F 84 %02x\n", tag[2]);
+                       eDebug("unknown APDU tag 9F 84 %02x", tag[2]);
                        break;
                }
        }
                        break;
                }
        }
@@ -39,7 +40,7 @@ int eDVBCIDateTimeSession::doAction()
                return 0;
        }
        case stateFinal:
                return 0;
        }
        case stateFinal:
-               printf("stateFinal und action! kann doch garnicht sein ;)\n");
+               eDebug("stateFinal und action! kann doch garnicht sein ;)");
        default:
                return 0;
        }
        default:
                return 0;
        }
index 2971066..b616ebc 100644 (file)
@@ -30,10 +30,10 @@ eDVBCIMMISession::~eDVBCIMMISession()
 
 int eDVBCIMMISession::receivedAPDU(const unsigned char *tag, const void *data, int len)
 {
 
 int eDVBCIMMISession::receivedAPDU(const unsigned char *tag, const void *data, int len)
 {
-       printf("SESSION(%d)/MMI %02x %02x %02x: ", session_nb, tag[0], tag[1],tag[2]);
+       eDebugNoNewLine("SESSION(%d)/MMI %02x %02x %02x: ", session_nb, tag[0], tag[1],tag[2]);
        for (int i=0; i<len; i++)
        for (int i=0; i<len; i++)
-               printf("%02x ", ((const unsigned char*)data)[i]);
-       printf("\n");
+               eDebugNoNewLine("%02x ", ((const unsigned char*)data)[i]);
+       eDebug("");
 
        if ((tag[0]==0x9f) && (tag[1]==0x88))
        {
 
        if ((tag[0]==0x9f) && (tag[1]==0x88))
        {
@@ -59,9 +59,9 @@ int eDVBCIMMISession::receivedAPDU(const unsigned char *tag, const void *data, i
                        break;
                }
                case 0x01:
                        break;
                }
                case 0x01:
-                       printf("MMI display control\n");
+                       eDebug("MMI display control");
                        if (((unsigned char*)data)[0] != 1)
                        if (((unsigned char*)data)[0] != 1)
-                               printf("kann ich nicht. aber das sag ich dem modul nicht.\n");
+                               eDebug("kann ich nicht. aber das sag ich dem modul nicht.");
                        state=stateDisplayReply;
                        return 1;
                case 0x07:              //Tmenu_enq
                        state=stateDisplayReply;
                        return 1;
                case 0x07:              //Tmenu_enq
@@ -70,7 +70,7 @@ int eDVBCIMMISession::receivedAPDU(const unsigned char *tag, const void *data, i
                        unsigned char *max=((unsigned char*)d) + len;
                        int textlen = len - 2;
 
                        unsigned char *max=((unsigned char*)d) + len;
                        int textlen = len - 2;
 
-                       printf("in enq\n");
+                       eDebug("in enq");
                        
                        if ((d+2) > max)
                                break;
                        
                        if ((d+2) > max)
                                break;
@@ -78,7 +78,7 @@ int eDVBCIMMISession::receivedAPDU(const unsigned char *tag, const void *data, i
                        int blind = *d++ & 1;
                        int alen = *d++;
 
                        int blind = *d++ & 1;
                        int alen = *d++;
 
-                       printf("%d bytes text\n", textlen);
+                       eDebug("%d bytes text", textlen);
                        if ((d+textlen) > max)
                                break;
                        
                        if ((d+textlen) > max)
                                break;
                        
@@ -86,7 +86,7 @@ int eDVBCIMMISession::receivedAPDU(const unsigned char *tag, const void *data, i
                        memcpy(str, ((char*)d), textlen);
                        str[textlen] = '\0';
                        
                        memcpy(str, ((char*)d), textlen);
                        str[textlen] = '\0';
                        
-                       printf("enq-text: %s\n",str);
+                       eDebug("enq-text: %s",str);
                        
                        eDVBCI_UI::getInstance()->mmiScreenEnq(slot->getSlotID(), blind, alen, (char*)convertDVBUTF8(str).c_str());
 
                        
                        eDVBCI_UI::getInstance()->mmiScreenEnq(slot->getSlotID(), blind, alen, (char*)convertDVBUTF8(str).c_str());
 
@@ -98,7 +98,7 @@ int eDVBCIMMISession::receivedAPDU(const unsigned char *tag, const void *data, i
                        unsigned char *d=(unsigned char*)data;
                        unsigned char *max=((unsigned char*)d) + len;
                        int pos = 0;
                        unsigned char *d=(unsigned char*)data;
                        unsigned char *max=((unsigned char*)d) + len;
                        int pos = 0;
-                       printf("Tmenu_last\n");
+                       eDebug("Tmenu_last");
                        if (d > max)
                                break;
                        int n=*d++;
                        if (d > max)
                                break;
                        int n=*d++;
@@ -112,16 +112,16 @@ int eDVBCIMMISession::receivedAPDU(const unsigned char *tag, const void *data, i
                                n=0;
                        else
                                n++;
                                n=0;
                        else
                                n++;
-                       printf("%d texts\n", n);
+                       eDebug("%d texts", n);
                        for (int i=0; i < (n+3); ++i)
                        {
                                int textlen;
                                if ((d+3) > max)
                                        break;
                        for (int i=0; i < (n+3); ++i)
                        {
                                int textlen;
                                if ((d+3) > max)
                                        break;
-                               printf("text tag: %02x %02x %02x\n", d[0], d[1], d[2]);
+                               eDebug("text tag: %02x %02x %02x", d[0], d[1], d[2]);
                                d+=3;
                                d+=parseLengthField(d, textlen);
                                d+=3;
                                d+=parseLengthField(d, textlen);
-                               printf("%d bytes text\n", textlen);
+                               eDebug("%d bytes text", textlen);
                                if ((d+textlen) > max)
                                        break;
                                        
                                if ((d+textlen) > max)
                                        break;
                                        
@@ -132,14 +132,14 @@ int eDVBCIMMISession::receivedAPDU(const unsigned char *tag, const void *data, i
                                eDVBCI_UI::getInstance()->mmiScreenAddText(slot->getSlotID(), pos++, (char*)convertDVBUTF8(str).c_str());
                                        
                                while (textlen--)
                                eDVBCI_UI::getInstance()->mmiScreenAddText(slot->getSlotID(), pos++, (char*)convertDVBUTF8(str).c_str());
                                        
                                while (textlen--)
-                                       printf("%c", *d++);
-                               printf("\n");
+                                       eDebugNoNewLine("%c", *d++);
+                               eDebug("");
                        }
                        eDVBCI_UI::getInstance()->mmiScreenFinish(slot->getSlotID());
                        break;
                }
                default:
                        }
                        eDVBCI_UI::getInstance()->mmiScreenFinish(slot->getSlotID());
                        break;
                }
                default:
-                       printf("unknown APDU tag 9F 88 %02x\n", tag[2]);
+                       eDebug("unknown APDU tag 9F 88 %02x", tag[2]);
                        break;
                }
        }
                        break;
                }
        }
@@ -181,7 +181,7 @@ int eDVBCIMMISession::doAction()
 
 int eDVBCIMMISession::stopMMI()
 {
 
 int eDVBCIMMISession::stopMMI()
 {
-       printf("eDVBCIMMISession::stopMMI()\n");
+       eDebug("eDVBCIMMISession::stopMMI()");
 
        unsigned char tag[]={0x9f, 0x88, 0x00};
        unsigned char data[]={0x00};
 
        unsigned char tag[]={0x9f, 0x88, 0x00};
        unsigned char data[]={0x00};
@@ -192,7 +192,7 @@ int eDVBCIMMISession::stopMMI()
 
 int eDVBCIMMISession::answerText(int answer)
 {
 
 int eDVBCIMMISession::answerText(int answer)
 {
-       printf("eDVBCIMMISession::answerText(%d)\n",answer);
+       eDebug("eDVBCIMMISession::answerText(%d)",answer);
 
        unsigned char tag[]={0x9f, 0x88, 0x0B};
        unsigned char data[]={0x00};
 
        unsigned char tag[]={0x9f, 0x88, 0x0B};
        unsigned char data[]={0x00};
@@ -205,7 +205,7 @@ int eDVBCIMMISession::answerText(int answer)
 int eDVBCIMMISession::answerEnq(char *answer)
 {
        unsigned int len = strlen(answer);
 int eDVBCIMMISession::answerEnq(char *answer)
 {
        unsigned int len = strlen(answer);
-       printf("eDVBCIMMISession::answerEnq(%d bytes)\n", len);
+       eDebug("eDVBCIMMISession::answerEnq(%d bytes)", len);
 
        unsigned char data[len+1];
        data[0] = 0x01; // answer ok
 
        unsigned char data[len+1];
        data[0] = 0x01; // answer ok
@@ -219,7 +219,7 @@ int eDVBCIMMISession::answerEnq(char *answer)
 
 int eDVBCIMMISession::cancelEnq()
 {
 
 int eDVBCIMMISession::cancelEnq()
 {
-       printf("eDVBCIMMISession::cancelEnq()\n");
+       eDebug("eDVBCIMMISession::cancelEnq()");
 
        unsigned char tag[]={0x9f, 0x88, 0x08};
        unsigned char data[]={0x00}; // canceled
 
        unsigned char tag[]={0x9f, 0x88, 0x08};
        unsigned char data[]={0x00}; // canceled
index e9e4bd1..7382bf2 100644 (file)
@@ -1,29 +1,30 @@
 /* DVB CI Resource Manager */
 
 /* DVB CI Resource Manager */
 
+#include <lib/base/eerror.h>
 #include <lib/dvb_ci/dvbci_resmgr.h>
 
 int eDVBCIResourceManagerSession::receivedAPDU(const unsigned char *tag,const void *data, int len)
 {
 #include <lib/dvb_ci/dvbci_resmgr.h>
 
 int eDVBCIResourceManagerSession::receivedAPDU(const unsigned char *tag,const void *data, int len)
 {
-       printf("SESSION(%d) %02x %02x %02x: ", session_nb, tag[0], tag[1], tag[2]);
+       eDebugNoNewLine("SESSION(%d) %02x %02x %02x: ", session_nb, tag[0], tag[1], tag[2]);
        for (int i=0; i<len; i++)
        for (int i=0; i<len; i++)
-               printf("%02x ", ((const unsigned char*)data)[i]);
-       printf("\n");
+               eDebugNoNewLine("%02x ", ((const unsigned char*)data)[i]);
+       eDebug("");
        if ((tag[0]==0x9f) && (tag[1]==0x80))
        {
                switch (tag[2])
                {
                case 0x10:  // profile enquiry
        if ((tag[0]==0x9f) && (tag[1]==0x80))
        {
                switch (tag[2])
                {
                case 0x10:  // profile enquiry
-                       printf("cam fragt was ich kann.\n");
+                       eDebug("cam fragt was ich kann.");
                        state=stateProfileEnquiry;
                        return 1;
                        break;
                case 0x11: // Tprofile
                        state=stateProfileEnquiry;
                        return 1;
                        break;
                case 0x11: // Tprofile
-                       printf("mein cam kann: ");
+                       eDebugNoNewLine("mein cam kann: ");
                        if (!len)
                        if (!len)
-                               printf("nichts\n");
+                               eDebug("nichts");
                        else
                                for (int i=0; i<len; i++)
                        else
                                for (int i=0; i<len; i++)
-                                       printf("%02x ", ((const unsigned char*)data)[i]);
+                                       eDebugNoNewLine("%02x ", ((const unsigned char*)data)[i]);
 
                        if (state == stateFirstProfileEnquiry)
                        {
 
                        if (state == stateFirstProfileEnquiry)
                        {
@@ -33,7 +34,7 @@ int eDVBCIResourceManagerSession::receivedAPDU(const unsigned char *tag,const vo
                        state=stateFinal;
                        break;
                default:
                        state=stateFinal;
                        break;
                default:
-                       printf("unknown APDU tag 9F 80 %02x\n", tag[2]);
+                       eDebug("unknown APDU tag 9F 80 %02x", tag[2]);
                }
        }
        
                }
        }
        
@@ -60,7 +61,7 @@ int eDVBCIResourceManagerSession::doAction()
        }
   case stateProfileChange:
   {
        }
   case stateProfileChange:
   {
-    printf("bla kaputt\n");
+    eDebug("bla kaputt");
     break;
   }
        case stateProfileEnquiry:
     break;
   }
        case stateProfileEnquiry:
@@ -81,7 +82,7 @@ int eDVBCIResourceManagerSession::doAction()
                return 0;
        }
        case stateFinal:
                return 0;
        }
        case stateFinal:
-               printf("stateFinal und action! kann doch garnicht sein ;)\n");
+               eDebug("stateFinal und action! kann doch garnicht sein ;)");
        default:
                break;
        }
        default:
                break;
        }
index e0e64be..e5a669f 100644 (file)
@@ -1,5 +1,6 @@
 /* DVB CI Transport Connection */
 
 /* DVB CI Transport Connection */
 
+#include <lib/base/eerror.h>
 #include <lib/dvb_ci/dvbci_session.h>
 #include <lib/dvb_ci/dvbci_resmgr.h>
 #include <lib/dvb_ci/dvbci_appmgr.h>
 #include <lib/dvb_ci/dvbci_session.h>
 #include <lib/dvb_ci/dvbci_resmgr.h>
 #include <lib/dvb_ci/dvbci_appmgr.h>
@@ -30,7 +31,7 @@ int eDVBCISession::buildLengthField(unsigned char *pkt, int len)
                return 3;
        } else
        {
                return 3;
        } else
        {
-               printf("too big length\n");
+               eDebug("too big length");
                exit(0);
        }
 }
                exit(0);
        }
 }
@@ -90,7 +91,7 @@ void eDVBCISession::sendOpenSessionResponse(eDVBCISlot *slot, unsigned char sess
 {
        char pkt[6];
        pkt[0]=session_status;
 {
        char pkt[6];
        pkt[0]=session_status;
-       printf("sendOpenSessionResponse\n");
+       eDebug("sendOpenSessionResponse");
        memcpy(pkt + 1, resource_identifier, 4);
        sendSPDU(slot, 0x92, pkt, 5, session_nb);
 }
        memcpy(pkt + 1, resource_identifier, 4);
        sendSPDU(slot, 0x92, pkt, 5, session_nb);
 }
@@ -100,14 +101,14 @@ void eDVBCISession::recvCreateSessionResponse(const unsigned char *data)
        status = data[0];
        state = stateStarted;
        action = 1;
        status = data[0];
        state = stateStarted;
        action = 1;
-       printf("create Session Response, status %x\n", status);
+       eDebug("create Session Response, status %x", status);
 }
 
 void eDVBCISession::recvCloseSessionRequest(const unsigned char *data)
 {
        state = stateInDeletion;
        action = 1;
 }
 
 void eDVBCISession::recvCloseSessionRequest(const unsigned char *data)
 {
        state = stateInDeletion;
        action = 1;
-       printf("close Session Request\n");
+       eDebug("close Session Request");
 }
 
 void eDVBCISession::deleteSessions(const eDVBCISlot *slot)
 }
 
 void eDVBCISession::deleteSessions(const eDVBCISlot *slot)
@@ -144,42 +145,42 @@ void eDVBCISession::createSession(eDVBCISlot *slot, const unsigned char *resourc
        {
        case 0x00010041:
                session=new eDVBCIResourceManagerSession;
        {
        case 0x00010041:
                session=new eDVBCIResourceManagerSession;
-               printf("RESOURCE MANAGER\n");
+               eDebug("RESOURCE MANAGER");
                break;
        case 0x00020041:
                session=new eDVBCIApplicationManagerSession(slot);
                break;
        case 0x00020041:
                session=new eDVBCIApplicationManagerSession(slot);
-               printf("APPLICATION MANAGER\n");
+               eDebug("APPLICATION MANAGER");
                break;
        case 0x00030041:
                session = new eDVBCICAManagerSession(slot);
                break;
        case 0x00030041:
                session = new eDVBCICAManagerSession(slot);
-               printf("CA MANAGER\n");
+               eDebug("CA MANAGER");
                break;
        case 0x00240041:
                session=new eDVBCIDateTimeSession;
                break;
        case 0x00240041:
                session=new eDVBCIDateTimeSession;
-               printf("DATE-TIME\n");
+               eDebug("DATE-TIME");
                break;
        case 0x00400041:
                session = new eDVBCIMMISession(slot);
                break;
        case 0x00400041:
                session = new eDVBCIMMISession(slot);
-               printf("MMI - create session\n");
+               eDebug("MMI - create session");
                break;
        case 0x00100041:
 //             session=new eDVBCIAuthSession;
                break;
        case 0x00100041:
 //             session=new eDVBCIAuthSession;
-               printf("AuthSession\n");
+               eDebug("AuthSession");
 //             break;
        case 0x00200041:
        default:
 //             break;
        case 0x00200041:
        default:
-               printf("unknown resource type %02x %02x %02x %02x\n", resource_identifier[0], resource_identifier[1], resource_identifier[2],resource_identifier[3]);
+               eDebug("unknown resource type %02x %02x %02x %02x", resource_identifier[0], resource_identifier[1], resource_identifier[2],resource_identifier[3]);
                session=0;
                status=0xF0;
        }
 
        if (!session)
        {
                session=0;
                status=0xF0;
        }
 
        if (!session)
        {
-               printf("unknown session.. expect crash\n");
+               eDebug("unknown session.. expect crash");
                return;
        }
 
                return;
        }
 
-       printf("new session nb %d %p\n", session_nb, &(*session));
+       eDebug("new session nb %d %p", session_nb, &(*session));
        session->session_nb = session_nb;
 
        if (session)
        session->session_nb = session_nb;
 
        if (session)
@@ -224,11 +225,11 @@ void eDVBCISession::receiveData(eDVBCISlot *slot, const unsigned char *ptr, size
        unsigned char tag = *pkt++;
        int llen, hlen;
 
        unsigned char tag = *pkt++;
        int llen, hlen;
 
-       printf("slot: %p\n",slot);
+       eDebug("slot: %p",slot);
 
        for(unsigned int i=0;i<len;i++)
 
        for(unsigned int i=0;i<len;i++)
-               printf("%02x ",ptr[i]);
-       printf("\n");
+               eDebugNoNewLine("%02x ",ptr[i]);
+       eDebug("");
        
        llen = parseLengthField(pkt, hlen);
        pkt += llen;
        
        llen = parseLengthField(pkt, hlen);
        pkt += llen;
@@ -255,14 +256,14 @@ void eDVBCISession::receiveData(eDVBCISlot *slot, const unsigned char *ptr, size
                
                if ((!session_nb) || (session_nb >= SLMS))
                {
                
                if ((!session_nb) || (session_nb >= SLMS))
                {
-                       printf("PROTOCOL: illegal session number %x\n", session_nb);
+                       eDebug("PROTOCOL: illegal session number %x", session_nb);
                        return;
                }
                
                session=sessions[session_nb-1];
                if (!session)
                {
                        return;
                }
                
                session=sessions[session_nb-1];
                if (!session)
                {
-                       printf("PROTOCOL: data on closed session %x\n", session_nb);
+                       eDebug("PROTOCOL: data on closed session %x", session_nb);
                        return;
                }
 
                        return;
                }
 
@@ -274,11 +275,11 @@ void eDVBCISession::receiveData(eDVBCISlot *slot, const unsigned char *ptr, size
                        session->recvCreateSessionResponse(pkt);
                        break;
                case 0x95:
                        session->recvCreateSessionResponse(pkt);
                        break;
                case 0x95:
-                       printf("recvCloseSessionRequest\n");
+                       eDebug("recvCloseSessionRequest");
                        session->recvCloseSessionRequest(pkt);
                        break;
                default:
                        session->recvCloseSessionRequest(pkt);
                        break;
                default:
-                       printf("INTERNAL: nyi, tag %02x.\n", tag);
+                       eDebug("INTERNAL: nyi, tag %02x.", tag);
                        return;
                }
        }
                        return;
                }
        }
@@ -303,7 +304,7 @@ void eDVBCISession::receiveData(eDVBCISlot *slot, const unsigned char *ptr, size
                        {
                                if (((len-alen) > 0) && ((len - alen) < 3))
                                {
                        {
                                if (((len-alen) > 0) && ((len - alen) < 3))
                                {
-                                       printf("WORKAROUND: applying work around MagicAPDULength\n");
+                                       eDebug("WORKAROUND: applying work around MagicAPDULength");
                                        alen=len;
                                }
                        }
                                        alen=len;
                                }
                        }
@@ -314,11 +315,11 @@ void eDVBCISession::receiveData(eDVBCISlot *slot, const unsigned char *ptr, size
                }
                
        if (len)
                }
                
        if (len)
-               printf("PROTOCOL: warning, TL-Data has invalid length\n");
+               eDebug("PROTOCOL: warning, TL-Data has invalid length");
 }
 
 eDVBCISession::~eDVBCISession()
 {
 }
 
 eDVBCISession::~eDVBCISession()
 {
-//     printf("destroy %p\n", this);
+//     eDebug("destroy %p", this);
 }
 
 }
 
index ce9aac1..1ff0c32 100644 (file)
@@ -175,7 +175,7 @@ int eDVBCI_UI::mmiScreenBegin(int slot, int listmenu)
        if (slot >= MAX_SLOTS)
                return 0;
 
        if (slot >= MAX_SLOTS)
                return 0;
 
-       printf("eDVBCI_UI::mmiScreenBegin\n");
+       eDebug("eDVBCI_UI::mmiScreenBegin");
 
        slot_ui_data &data = slotdata[slot];
 
 
        slot_ui_data &data = slotdata[slot];
 
@@ -238,7 +238,7 @@ int eDVBCI_UI::mmiScreenFinish(int slot)
 {
        if (slot < MAX_SLOTS)
        {
 {
        if (slot < MAX_SLOTS)
        {
-               printf("eDVBCI_UI::mmiScreenFinish\n");
+               eDebug("eDVBCI_UI::mmiScreenFinish");
                slotdata[slot].mmiScreenReady = 1;
                /*emit*/ ciStateChanged(slot);
        }
                slotdata[slot].mmiScreenReady = 1;
                /*emit*/ ciStateChanged(slot);
        }