00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #include <e32base.h>
00033 #include <e32cons.h>
00034 #include "rconnection.h"
00035
00036
00037 _LIT(KRow01,"*****************************************\n");
00038 _LIT(KRow02,"* Welcome to RConnection Example *\n");
00039 _LIT(KRow03,"*****************************************\n");
00040 _LIT(KRow04,"Press a Key to step through the Example\n");
00041 _LIT(KNewLine,"\n");
00042
00043 static void DoStartL(CConsoleBase* aConsole);
00044 static void WelcomeScreen(CConsoleBase* aConsole);
00045 static void CallExampleL();
00046
00047 static void DoStartL(CConsoleBase* aConsole)
00048 {
00049
00050 CActiveScheduler* scheduler = new (ELeave) CActiveScheduler();
00051 CleanupStack::PushL(scheduler);
00052 CActiveScheduler::Install(scheduler);
00053
00054 CRConnection* example = new (ELeave) CRConnection(aConsole);
00055 CleanupStack::PushL(example);
00056
00057 WelcomeScreen(aConsole);
00058
00059 example->DemoApiWithoutDbOverrideL();
00060
00061 example->DemoApiWithDbOverrideL();
00062
00063 example->AttachToExistingInterfaceL();
00064
00065 CleanupStack::PopAndDestroy(example);
00066
00067
00068 CleanupStack::PopAndDestroy(scheduler);
00069 }
00070
00071 static void CallExampleL()
00072 {
00073 _LIT(KTxtExampleCode,"Symbian platform Example Code");
00074 _LIT(KFormatFailed,"failed: leave code=%d");
00075 _LIT(KTxtOK,"ok");
00076 _LIT(KTxtPressAnyKey," [press any key to exit]");
00077
00078 CConsoleBase* console=Console::NewL(KTxtExampleCode,TSize(KConsFullScreen,KConsFullScreen));
00079 CleanupStack::PushL(console);
00080
00081 TRAPD(error,DoStartL(console));
00082
00083 if (error)
00084 console->Printf(KFormatFailed, error);
00085 else
00086 console->Printf(KTxtOK);
00087
00088 console->Printf(KTxtPressAnyKey);
00089 console->Getch();
00090
00091 CleanupStack::PopAndDestroy();
00092 }
00093
00094 extern TInt E32Main()
00095 {
00096 _LIT(KEgPanicCat,"EXAMPLES");
00097 __UHEAP_MARK;
00098 CTrapCleanup* cleanup=CTrapCleanup::New();
00099 TRAPD(error,CallExampleL());
00100 __ASSERT_ALWAYS(!error,User::Panic(KEgPanicCat,error));
00101 delete cleanup;
00102 __UHEAP_MARKEND;
00103 return 0;
00104 }
00105
00106
00107 static void WelcomeScreen(CConsoleBase* aConsole)
00108 {
00109 aConsole->ClearScreen();
00110 aConsole->Printf(KRow01);
00111 aConsole->Printf(KRow02);
00112 aConsole->Printf(KRow03);
00113 aConsole->Printf(KNewLine);
00114 aConsole->Printf(KRow04);
00115 aConsole->Getch();
00116 }
00117