diff -r 89d6a7a84779 -r 25a17d01db0c Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/_common_files_8h-source.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/_common_files_8h-source.html Fri Jan 22 18:26:19 2010 +0000 @@ -0,0 +1,69 @@ + +
+00001 // Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies). +00002 // All rights reserved. +00003 // This component and the accompanying materials are made available +00004 // under the terms of "Eclipse Public License v1.0" +00005 // which accompanies this distribution, and is available +00006 // at the URL "http://www.eclipse.org/legal/epl-v10.html". +00007 // +00008 // Initial Contributors: +00009 // Nokia Corporation - initial contribution. +00010 // +00011 // Contributors: +00012 // +00013 // Description: +00014 // +00015 +00016 +00017 #ifndef __CommonFiles_H +00018 #define __CommonFiles_H +00019 +00020 #include <e32cons.h> +00021 +00022 // public +00023 LOCAL_D CConsoleBase* console; // write all your messages to this +00024 LOCAL_C void doExampleL(); // code this function for the real example +00025 +00026 // private +00027 LOCAL_C void callExampleL(); // initialize with cleanup stack, then do example +00028 +00029 GLDEF_C TInt E32Main() // main function called by E32 +00030 { +00031 _LIT(KSymbianEx,"SymbianEx"); +00032 CTrapCleanup* cleanup=CTrapCleanup::New(); // get clean-up stack +00033 TRAPD(error,callExampleL()); // more initialization, then do example +00034 __ASSERT_ALWAYS(!error,User::Panic(KSymbianEx,error)); +00035 delete cleanup; // destroy clean-up stack +00036 return 0; // and return +00037 } +00038 +00039 LOCAL_C void callExampleL() // initialize and call example code under cleanup stack +00040 { +00041 _LIT(KStatus1,"Symbian platform Example Code (comms)"); +00042 _LIT(KStatus2,"failed: leave code=%d"); +00043 _LIT(KStatus3,"ok"); +00044 _LIT(KStatus4," [press any key]"); +00045 +00046 console=Console::NewL(KStatus1,TSize(KConsFullScreen,KConsFullScreen)); +00047 //console=Console::NewL(KStatus1, TSize(KDefaultConsWidth,KDefaultConsHeight)); +00048 CleanupStack::PushL(console); +00049 TRAPD(error,doExampleL()); // perform example function +00050 if (error) console->Printf(KStatus2, error); +00051 else console->Printf(KStatus3); +00052 console->Printf(KStatus4); +00053 console->Getch(); // get and ignore character +00054 CleanupStack::Pop(); // close console +00055 } +00056 +00057 #endif +