sapi_logging/tsrc/dev/tloggingservice/src/taddtest2.cpp
changeset 0 14df0fbfcc4e
equal deleted inserted replaced
-1:000000000000 0:14df0fbfcc4e
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 #include <e32svr.h>
       
    19 #include <e32std.h>
       
    20 #include <StifParser.h>
       
    21 #include <Stiftestinterface.h>
       
    22 #include <logcli.h>
       
    23 #include <logwrap.h>
       
    24 
       
    25 #include "loggingasyncservice.h"
       
    26 #include "loggingservice.h"
       
    27 #include "loggingevent.h"
       
    28 
       
    29 #include "tlogging.h"
       
    30 #include "tlogcallback.h"
       
    31 
       
    32 
       
    33 _LIT(KOwnEventSubject, "RandomLogEvent");
       
    34 _LIT(KOwnEventRemoteParty, "OwnContact");
       
    35 
       
    36 TInt AddEventasync3(void)
       
    37 	{
       
    38 	
       
    39 	 
       
    40 	CLoggingService *LogService = CLoggingService :: NewL() ;
       
    41 	CLogsEvent* event = CLogsEvent::NewL();
       
    42 	MLogCallback MyCb ;
       
    43 	   
       
    44 	   	// Sets the duration of the event in seconds.
       
    45 	// Randomize something between 0-299 
       
    46 	
       
    47 	event->SetDuration(300);
       
    48 	TUid eventTypeID = KLogCallEventTypeUid; 
       
    49 	event->SetEventType(eventTypeID);
       
    50 	event->SetSubject(KOwnEventSubject);
       
    51 	TTime time;			// creation time from the device clock
       
    52 	time.HomeTime();
       
    53 	event->SetTime(time); 
       
    54 	
       
    55 	TBuf<KLogMaxNumberLength> number; // Randomize number
       
    56 	number.AppendNum(7000000);
       
    57 	event->SetNumber(number);
       
    58 	event->SetRemoteParty(KOwnEventRemoteParty);
       
    59 	
       
    60     LogService->AddEventL(1 , event , &MyCb) ;
       
    61 	   
       
    62 	MyCb.Start() ;
       
    63 	   
       
    64 	delete event ;
       
    65 	delete LogService ;
       
    66 	
       
    67 
       
    68 	    
       
    69 	return KErrNone ;
       
    70 	}
       
    71