00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __DBSTD_H
00018 #define __DBSTD_H
00019
00020 #include <e32cons.h>
00021 #include <s32file.h>
00022 #include <d32dbms.h>
00023
00024
00025 LOCAL_D CConsoleBase* console;
00026 LOCAL_C void doExampleL();
00027 LOCAL_D RFs fsSession;
00028
00029
00030 LOCAL_C void callExampleL();
00031
00032 GLDEF_C TInt E32Main()
00033 {
00034 _LIT(KDbmsExample,"DBMS-Example");
00035 CTrapCleanup* cleanup=CTrapCleanup::New();
00036 TRAPD(error,callExampleL());
00037 __ASSERT_ALWAYS(!error,User::Panic(KDbmsExample,error));
00038 delete cleanup;
00039 return 0;
00040 }
00041
00042 LOCAL_C void callExampleL()
00043 {
00044 _LIT(KDbmsSdkExampleCode,"DBMS SDK Example Code");
00045 _LIT(KFileSessionConnectFailed,"file session connect failed: return code=%d");
00046 _LIT(KFailed,"failed: leave code=%d");
00047 _LIT(KOk,"ok");
00048 _LIT(KPressAnyKey," [press any key]");
00049
00050 console=Console::NewL(KDbmsSdkExampleCode,
00051 TSize(KConsFullScreen,KConsFullScreen));
00052 CleanupStack::PushL(console);
00053 TInt fsret = fsSession.Connect();
00054 if (fsret != KErrNone)
00055 {
00056 console->Printf(KFileSessionConnectFailed,fsret);
00057 User::Leave(fsret);
00058 }
00059 TRAPD(error,doExampleL());
00060 if (error) console->Printf(KFailed, error);
00061 else console->Printf(KOk);
00062 console->Printf(KPressAnyKey);
00063 console->Getch();
00064 fsSession.Close();
00065 CleanupStack::Pop();
00066 }
00067
00068 #endif