From 66188b9962f551dd0b6bcf06ba8bc0db396b3704 Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Thu, 24 Aug 2006 20:21:43 +0000 Subject: [PATCH] use eDebug instead of printf --- lib/dvb_ci/dvbci.cpp | 38 +++++++++++++------------- lib/dvb_ci/dvbci_appmgr.cpp | 33 +++++++++++----------- lib/dvb_ci/dvbci_camgr.cpp | 17 ++++++------ lib/dvb_ci/dvbci_datetimemgr.cpp | 11 ++++---- lib/dvb_ci/dvbci_mmi.cpp | 38 +++++++++++++------------- lib/dvb_ci/dvbci_resmgr.cpp | 21 +++++++------- lib/dvb_ci/dvbci_session.cpp | 47 ++++++++++++++++---------------- lib/dvb_ci/dvbci_ui.cpp | 4 +-- 8 files changed, 107 insertions(+), 102 deletions(-) diff --git a/lib/dvb_ci/dvbci.cpp b/lib/dvb_ci/dvbci.cpp index 632ab348..d95f6832 100644 --- a/lib/dvb_ci/dvbci.cpp +++ b/lib/dvb_ci/dvbci.cpp @@ -62,7 +62,7 @@ eDVBCISlot *eDVBCIInterfaces::getSlot(int slotid) if(i->getSlotID() == slotid) return i; - printf("FIXME: request for unknown slot\n"); + eDebug("FIXME: request for unknown slot"); return 0; } @@ -422,10 +422,10 @@ int eDVBCISlot::send(const unsigned char *data, size_t len) { int res=0; //int i; - //printf("< "); + //eDebugNoNewLine("< "); //for(i=0;i 0) { // int i; -// printf("> "); +// eDebugNoNewLine("> "); // for(i=0;istartMMI(); @@ -592,7 +592,7 @@ int eDVBCISlot::startMMI() int eDVBCISlot::stopMMI() { - printf("edvbcislot: stopMMI()\n"); + eDebug("edvbcislot: stopMMI()"); if(mmi_session) mmi_session->stopMMI(); @@ -602,7 +602,7 @@ int eDVBCISlot::stopMMI() int eDVBCISlot::answerText(int answer) { - printf("edvbcislot: answerText(%d)\n", answer); + eDebug("edvbcislot: answerText(%d)", answer); if(mmi_session) mmi_session->answerText(answer); @@ -620,7 +620,7 @@ int eDVBCISlot::getMMIState() int eDVBCISlot::answerEnq(char *value) { - printf("edvbcislot: answerENQ(%s)\n", value); + eDebug("edvbcislot: answerENQ(%s)", value); if(mmi_session) mmi_session->answerEnq(value); @@ -630,7 +630,7 @@ int eDVBCISlot::answerEnq(char *value) int eDVBCISlot::cancelEnq() { - printf("edvbcislot: cancelENQ\n"); + eDebug("edvbcislot: 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) { -// 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) { - 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) { - 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) { - printf("cannot open /proc/stb/tsmux/input2\n"); + eDebug("cannot open /proc/stb/tsmux/input2"); return 0; } diff --git a/lib/dvb_ci/dvbci_appmgr.cpp b/lib/dvb_ci/dvbci_appmgr.cpp index f8159730..b3e9ca14 100644 --- a/lib/dvb_ci/dvbci_appmgr.cpp +++ b/lib/dvb_ci/dvbci_appmgr.cpp @@ -1,5 +1,6 @@ /* DVB CI Application Manager */ +#include #include #include @@ -16,10 +17,10 @@ eDVBCIApplicationManagerSession::~eDVBCIApplicationManagerSession() 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) { - 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) - printf("%c", ((unsigned char*)data)[i+6]); - printf("\n"); + eDebugNoNewLine("%c", ((unsigned char*)data)[i+6]); + eDebug(""); eDVBCI_UI::getInstance()->setAppName(slot->getSlotID(), str); @@ -53,7 +54,7 @@ int eDVBCIApplicationManagerSession::receivedAPDU(const unsigned char *tag,const break; } default: - printf("unknown APDU tag 9F 80 %02x\n", tag[2]); + eDebug("unknown APDU tag 9F 80 %02x", tag[2]); break; } } @@ -72,11 +73,11 @@ int eDVBCIApplicationManagerSession::doAction() return 1; } case stateFinal: - printf("in final state.\n"); + eDebug("in final state."); 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; @@ -90,7 +91,7 @@ int eDVBCIApplicationManagerSession::doAction() 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; diff --git a/lib/dvb_ci/dvbci_camgr.cpp b/lib/dvb_ci/dvbci_camgr.cpp index ef69ed4d..42317b3e 100644 --- a/lib/dvb_ci/dvbci_camgr.cpp +++ b/lib/dvb_ci/dvbci_camgr.cpp @@ -1,5 +1,6 @@ /* DVB CI CA Manager */ +#include #include eDVBCICAManagerSession::eDVBCICAManagerSession(eDVBCISlot *tslot) @@ -15,28 +16,28 @@ eDVBCICAManagerSession::~eDVBCICAManagerSession() 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; irecheckPMTHandlers(); break; default: - printf("unknown APDU tag 9F 80 %02x\n", tag[2]); + eDebug("unknown APDU tag 9F 80 %02x", tag[2]); break; } } @@ -55,7 +56,7 @@ int eDVBCICAManagerSession::doAction() return 0; } case stateFinal: - printf("stateFinal und action! kann doch garnicht sein ;)\n"); + eDebug("stateFinal und action! kann doch garnicht sein ;)"); default: return 0; } diff --git a/lib/dvb_ci/dvbci_datetimemgr.cpp b/lib/dvb_ci/dvbci_datetimemgr.cpp index 5d2c61d1..f2b8a5c4 100644 --- a/lib/dvb_ci/dvbci_datetimemgr.cpp +++ b/lib/dvb_ci/dvbci_datetimemgr.cpp @@ -1,13 +1,14 @@ /* DVB CI DateTime Manager */ +#include #include 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 max) break; @@ -78,7 +78,7 @@ int eDVBCIMMISession::receivedAPDU(const unsigned char *tag, const void *data, i int blind = *d++ & 1; int alen = *d++; - printf("%d bytes text\n", textlen); + eDebug("%d bytes text", textlen); 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'; - printf("enq-text: %s\n",str); + eDebug("enq-text: %s",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; - printf("Tmenu_last\n"); + eDebug("Tmenu_last"); 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++; - printf("%d texts\n", n); + eDebug("%d texts", n); 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); - printf("%d bytes text\n", textlen); + eDebug("%d bytes text", textlen); 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--) - printf("%c", *d++); - printf("\n"); + eDebugNoNewLine("%c", *d++); + eDebug(""); } 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; } } @@ -181,7 +181,7 @@ int eDVBCIMMISession::doAction() int eDVBCIMMISession::stopMMI() { - printf("eDVBCIMMISession::stopMMI()\n"); + eDebug("eDVBCIMMISession::stopMMI()"); unsigned char tag[]={0x9f, 0x88, 0x00}; unsigned char data[]={0x00}; @@ -192,7 +192,7 @@ int eDVBCIMMISession::stopMMI() 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}; @@ -205,7 +205,7 @@ int eDVBCIMMISession::answerText(int 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 @@ -219,7 +219,7 @@ int eDVBCIMMISession::answerEnq(char *answer) int eDVBCIMMISession::cancelEnq() { - printf("eDVBCIMMISession::cancelEnq()\n"); + eDebug("eDVBCIMMISession::cancelEnq()"); unsigned char tag[]={0x9f, 0x88, 0x08}; unsigned char data[]={0x00}; // canceled diff --git a/lib/dvb_ci/dvbci_resmgr.cpp b/lib/dvb_ci/dvbci_resmgr.cpp index e9e4bd1b..7382bf2e 100644 --- a/lib/dvb_ci/dvbci_resmgr.cpp +++ b/lib/dvb_ci/dvbci_resmgr.cpp @@ -1,29 +1,30 @@ /* DVB CI Resource Manager */ +#include #include 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 #include #include #include @@ -30,7 +31,7 @@ int eDVBCISession::buildLengthField(unsigned char *pkt, int len) return 3; } else { - printf("too big length\n"); + eDebug("too big length"); exit(0); } } @@ -90,7 +91,7 @@ void eDVBCISession::sendOpenSessionResponse(eDVBCISlot *slot, unsigned char sess { 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); } @@ -100,14 +101,14 @@ void eDVBCISession::recvCreateSessionResponse(const unsigned char *data) 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; - printf("close Session Request\n"); + eDebug("close Session Request"); } void eDVBCISession::deleteSessions(const eDVBCISlot *slot) @@ -144,42 +145,42 @@ void eDVBCISession::createSession(eDVBCISlot *slot, const unsigned char *resourc { case 0x00010041: session=new eDVBCIResourceManagerSession; - printf("RESOURCE MANAGER\n"); + eDebug("RESOURCE MANAGER"); break; case 0x00020041: session=new eDVBCIApplicationManagerSession(slot); - printf("APPLICATION MANAGER\n"); + eDebug("APPLICATION MANAGER"); break; case 0x00030041: session = new eDVBCICAManagerSession(slot); - printf("CA MANAGER\n"); + eDebug("CA MANAGER"); break; case 0x00240041: session=new eDVBCIDateTimeSession; - printf("DATE-TIME\n"); + eDebug("DATE-TIME"); break; case 0x00400041: session = new eDVBCIMMISession(slot); - printf("MMI - create session\n"); + eDebug("MMI - create session"); break; case 0x00100041: // session=new eDVBCIAuthSession; - printf("AuthSession\n"); + eDebug("AuthSession"); // 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) { - printf("unknown session.. expect crash\n"); + eDebug("unknown session.. expect crash"); 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) @@ -224,11 +225,11 @@ void eDVBCISession::receiveData(eDVBCISlot *slot, const unsigned char *ptr, size unsigned char tag = *pkt++; int llen, hlen; - printf("slot: %p\n",slot); + eDebug("slot: %p",slot); for(unsigned int i=0;i= 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) { - printf("PROTOCOL: data on closed session %x\n", session_nb); + eDebug("PROTOCOL: data on closed session %x", session_nb); return; } @@ -274,11 +275,11 @@ void eDVBCISession::receiveData(eDVBCISlot *slot, const unsigned char *ptr, size session->recvCreateSessionResponse(pkt); break; case 0x95: - printf("recvCloseSessionRequest\n"); + eDebug("recvCloseSessionRequest"); session->recvCloseSessionRequest(pkt); break; default: - printf("INTERNAL: nyi, tag %02x.\n", tag); + eDebug("INTERNAL: nyi, tag %02x.", tag); return; } } @@ -303,7 +304,7 @@ void eDVBCISession::receiveData(eDVBCISlot *slot, const unsigned char *ptr, size { if (((len-alen) > 0) && ((len - alen) < 3)) { - printf("WORKAROUND: applying work around MagicAPDULength\n"); + eDebug("WORKAROUND: applying work around MagicAPDULength"); alen=len; } } @@ -314,11 +315,11 @@ void eDVBCISession::receiveData(eDVBCISlot *slot, const unsigned char *ptr, size } if (len) - printf("PROTOCOL: warning, TL-Data has invalid length\n"); + eDebug("PROTOCOL: warning, TL-Data has invalid length"); } eDVBCISession::~eDVBCISession() { -// printf("destroy %p\n", this); +// eDebug("destroy %p", this); } diff --git a/lib/dvb_ci/dvbci_ui.cpp b/lib/dvb_ci/dvbci_ui.cpp index ce9aac1f..1ff0c326 100644 --- a/lib/dvb_ci/dvbci_ui.cpp +++ b/lib/dvb_ci/dvbci_ui.cpp @@ -175,7 +175,7 @@ int eDVBCI_UI::mmiScreenBegin(int slot, int listmenu) if (slot >= MAX_SLOTS) return 0; - printf("eDVBCI_UI::mmiScreenBegin\n"); + eDebug("eDVBCI_UI::mmiScreenBegin"); slot_ui_data &data = slotdata[slot]; @@ -238,7 +238,7 @@ int eDVBCI_UI::mmiScreenFinish(int slot) { if (slot < MAX_SLOTS) { - printf("eDVBCI_UI::mmiScreenFinish\n"); + eDebug("eDVBCI_UI::mmiScreenFinish"); slotdata[slot].mmiScreenReady = 1; /*emit*/ ciStateChanged(slot); } -- 2.30.2