serviceproviders/sapi_logging/tsrc/dev/tloggingservice/src/tconcurrenttest6.cpp
changeset 19 989d2f495d90
child 33 50974a8b132e
equal deleted inserted replaced
14:a36b1e19a461 19:989d2f495d90
       
     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 "loggingfilter.h"
       
    28 
       
    29 #include "tlogging.h"
       
    30 #include "tlogcallback.h"
       
    31 #include "loggingevent.h"
       
    32 
       
    33 
       
    34 //------------------------------------------------------------------
       
    35 //Concurrenttest6, core class test for concurrent async calls
       
    36 // DeleteEvent and DeleteEvent async test
       
    37 //------------------------------------------------------------------
       
    38 
       
    39 TInt concurrenttest6(void)
       
    40 	{
       
    41 //	TInt flag  ;
       
    42 	
       
    43 	_LIT(KOwnEventSubject, "RandomLogEvent");
       
    44 	_LIT(KOwnEventRemoteParty, "OwnContact");
       
    45 
       
    46 //	TLogId ret1 = 30 ;
       
    47 	CLoggingService *LogService = CLoggingService :: NewL() ;
       
    48     CLogsEvent* event = CLogsEvent::NewL();
       
    49 
       
    50 	// Sets the duration of the event in seconds.
       
    51 	// Randomize something between 0-299 
       
    52 	
       
    53 	event->SetDuration(300);
       
    54 	
       
    55 	TBuf<KLogMaxDirectionLength> direction;
       
    56 	
       
    57 	// Direction of the event is randomized
       
    58 
       
    59 	TInt dirID = R_LOG_DIR_IN;
       
    60 	TUid eventTypeID = KLogCallEventTypeUid; 
       
    61 	event->SetEventType(eventTypeID);
       
    62 	event->SetSubject(KOwnEventSubject);
       
    63 	TTime time;			// creation time from the device clock
       
    64 	time.HomeTime();
       
    65 	event->SetTime(time); 
       
    66 	
       
    67 	TBuf<KLogMaxNumberLength> number; // Randomize number
       
    68 	number.AppendNum(7000000);
       
    69 	event->SetNumber(number);
       
    70 	event->SetRemoteParty(KOwnEventRemoteParty);
       
    71 	MLogCallback Mycb ;
       
    72 	TLogId ret = LogService->AddEventL(event) ;
       
    73 	 LogService->DeleteEventL(2 , ret ,&Mycb);
       
    74     
       
    75 	
       
    76     
       
    77 
       
    78 	
       
    79 	if(ret == KErrServerBusy)
       
    80 		{
       
    81 		ret = KErrNone ;
       
    82 		}
       
    83 	delete event ;
       
    84 	delete LogService ;
       
    85 
       
    86 
       
    87 	return ret ;
       
    88 
       
    89 	 
       
    90 	}
       
    91