systemhealthmanagement/systemhealthmgr/test/sysmondemo/src/helloworld.cpp
changeset 0 4e1aa6a622a0
equal deleted inserted replaced
-1:000000000000 0:4e1aa6a622a0
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #include "e32cons.h"
       
    17 #include "e32std.h"
       
    18 #include "e32cmn.h"
       
    19 #include "e32property.h"
       
    20 #include <e32uid.h>
       
    21  
       
    22 void HelloWorldL()
       
    23 	{
       
    24 	
       
    25 	//Get startup mode	
       
    26 	TInt bootMode;
       
    27 	RProperty::Get(KUidSystemCategory, KSystemStartupModeKey, bootMode) ;
       
    28 	
       
    29 	//Get current time
       
    30 	TTime time;
       
    31 	time.HomeTime();
       
    32 	TBuf<40> timeString; // Holds the formatted date and time
       
    33     _LIT(KFormat1,"%:0%H%:1%T%:2%S%:3");
       
    34     time.FormatL(timeString,KFormat1);
       
    35 
       
    36 	//create display message
       
    37     TBuf<255> buf;
       
    38 	_LIT(KText, "Hello World, Mode %d, Current time is %S ");
       
    39 	buf.Format(KText, bootMode, &timeString);
       
    40 
       
    41 	User::InfoPrint(buf);
       
    42 
       
    43 	// This app doesn't finish
       
    44 	for(;;)
       
    45 		{
       
    46 		User::After(1000000) ;
       
    47 		}
       
    48 	}
       
    49 
       
    50 TInt E32Main()
       
    51 	{
       
    52 	__UHEAP_MARK;
       
    53 
       
    54 	CTrapCleanup* cleanup=CTrapCleanup::New();
       
    55 	
       
    56 	TInt err = KErrNone ;
       
    57 	
       
    58 	if (cleanup)
       
    59 		{
       
    60 		TRAP(err,HelloWorldL());
       
    61 		delete cleanup;
       
    62 		}
       
    63 	
       
    64 				
       
    65 	__UHEAP_MARKEND;
       
    66 
       
    67 	return (err);
       
    68 	}
       
    69 
       
    70