diff options
author | Benny Prijono <bennylp@teluu.com> | 2009-06-17 12:36:36 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2009-06-17 12:36:36 +0000 |
commit | 5336026593592ee0b4eacaacd93d9d119f40020e (patch) | |
tree | f49e6d6bab98e45c2f1fb52af9c80b55181f01d1 /pjlib/src/pjlib-test/main_symbian.cpp | |
parent | 0af5425964a96194759fcdb4c67043ad253ef58c (diff) |
Part of ticket #887:
- added pj_shutdown() in pjlib-test's test.c
- refactor main_symbian.cpp (it's not been used for a while)
- compilation error/warning about initializing pj_str_t struct from non-constant value
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@2769 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib/src/pjlib-test/main_symbian.cpp')
-rw-r--r-- | pjlib/src/pjlib-test/main_symbian.cpp | 104 |
1 files changed, 22 insertions, 82 deletions
diff --git a/pjlib/src/pjlib-test/main_symbian.cpp b/pjlib/src/pjlib-test/main_symbian.cpp index e57b080d..a91b671f 100644 --- a/pjlib/src/pjlib-test/main_symbian.cpp +++ b/pjlib/src/pjlib-test/main_symbian.cpp @@ -44,21 +44,6 @@ int main() LOCAL_D CConsoleBase* console; // write all messages to this -// Local Functions - -LOCAL_C void MainL() -{ - // - // add your program code here, example code below - // - test_main(); - - console->Printf(_L(" [press any key]\n")); - console->Getch(); - - CActiveScheduler::Stop(); -} - class MyScheduler : public CActiveScheduler { public: @@ -73,67 +58,6 @@ void MyScheduler::Error(TInt aError) const PJ_UNUSED_ARG(aError); } -class ProgramStarter : public CActive -{ -public: - static ProgramStarter *NewL(); - void Start(); - -protected: - ProgramStarter(); - void ConstructL(); - virtual void RunL(); - virtual void DoCancel(); - TInt RunError(TInt aError); - -private: - RTimer timer_; -}; - -ProgramStarter::ProgramStarter() -: CActive(EPriorityNormal) -{ -} - -void ProgramStarter::ConstructL() -{ - timer_.CreateLocal(); - CActiveScheduler::Add(this); -} - -ProgramStarter *ProgramStarter::NewL() -{ - ProgramStarter *self = new (ELeave) ProgramStarter; - CleanupStack::PushL(self); - - self->ConstructL(); - - CleanupStack::Pop(self); - return self; -} - -void ProgramStarter::Start() -{ - timer_.After(iStatus, 0); - SetActive(); -} - -void ProgramStarter::RunL() -{ - MainL(); -} - -void ProgramStarter::DoCancel() -{ -} - -TInt ProgramStarter::RunError(TInt aError) -{ - PJ_UNUSED_ARG(aError); - return KErrNone; -} - - LOCAL_C void DoStartL() { // Create active scheduler (to run active objects) @@ -141,25 +65,36 @@ LOCAL_C void DoStartL() CleanupStack::PushL(scheduler); CActiveScheduler::Install(scheduler); - ProgramStarter *starter = ProgramStarter::NewL(); - starter->Start(); + test_main(); - CActiveScheduler::Start(); + CActiveScheduler::Install(NULL); + CleanupStack::Pop(scheduler); + delete scheduler; } +#define WRITE_TO_DEBUG_CONSOLE -// Global Functions +#ifdef WRITE_TO_DEBUG_CONSOLE +#include<e32debug.h> +#endif +// Global Functions static void log_writer(int level, const char *buf, int len) { - wchar_t buf16[PJ_LOG_MAX_SIZE]; + static wchar_t buf16[PJ_LOG_MAX_SIZE]; PJ_UNUSED_ARG(level); pj_ansi_to_unicode(buf, len, buf16, PJ_ARRAY_SIZE(buf16)); - + buf16[len] = 0; + buf16[len+1] = 0; + TPtrC16 aBuf((const TUint16*)buf16, (TInt)len); console->Write(aBuf); + +#ifdef WRITE_TO_DEBUG_CONSOLE + RDebug::Print(aBuf); +#endif } @@ -180,12 +115,17 @@ GLDEF_C TInt E32Main() TRAPD(mainError, DoStartL()); if (mainError) console->Printf(_L(" failed, leave code = %d"), mainError); + console->Printf(_L(" [press any key]\n")); console->Getch(); delete console; delete cleanup; + + CloseSTDLIB(); + __UHEAP_MARKEND; + return KErrNone; } |