commonappservices/alarmservertest/TestAlarmSrv/AlarmCreateDelete/AlarmDelete.cpp
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 // Copyright (c) 1999-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 <e32base.h>
       
    17 #include <asclisession.h>
       
    18 #include <asshdalarm.h>
       
    19 
       
    20 
       
    21 LOCAL_C void MainL()
       
    22 	{
       
    23 	// Connect to the Alarm Server
       
    24 	RASCliSession asCliSession;
       
    25 	asCliSession = RASCliSession();
       
    26 	User::LeaveIfError(asCliSession.Connect());
       
    27 
       
    28 	// Get list of alarms
       
    29 	RArray<TAlarmId> alarmIds;
       
    30 	asCliSession.GetAlarmIdListL(alarmIds);
       
    31 	
       
    32 	// Delete all alarms in the Alarm Server
       
    33 	TInt i;
       
    34 	for(i = 0; i < alarmIds.Count(); i++)
       
    35 		{
       
    36 		asCliSession.AlarmDelete(alarmIds[i]);
       
    37 		}
       
    38 	alarmIds.Reset();
       
    39 	}
       
    40 
       
    41 GLDEF_C int E32Main()
       
    42 	{
       
    43 	__UHEAP_MARK;
       
    44 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    45 	if(!cleanup)
       
    46 		{
       
    47 		return KErrNoMemory;
       
    48 		}
       
    49 	TRAPD(err, MainL());
       
    50 	delete cleanup;
       
    51 	__UHEAP_MARKEND;
       
    52 	return err;
       
    53 	}
       
    54