commonuisupport/uikon/test/tmultiplealarm/TAlertServer.cpp
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 // Copyright (c) 2005-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 /**
       
    17  @file
       
    18  @internalComponent - Internal Symbian test code
       
    19 */
       
    20 
       
    21 #include <uikon/eikalsrv.h>
       
    22 #include "TRemoteFactory.h"
       
    23 
       
    24 static void StartServerL()
       
    25 	{
       
    26 	CActiveScheduler* sched = new CActiveScheduler();
       
    27 	CleanupStack::PushL(sched);
       
    28 	
       
    29 	CActiveScheduler::Install(sched);
       
    30 
       
    31 	CTRemoteFactory* remoteFactory = CTRemoteFactory::NewL();
       
    32 	CleanupStack::PushL(remoteFactory);
       
    33 	
       
    34 	CEikServAlarmAlertServer* server = NULL;
       
    35 
       
    36 	
       
    37 	TRAPD(err, server = CEikServAlarmAlertServer::NewL(remoteFactory, remoteFactory->MaxAlarms()));	
       
    38 
       
    39 
       
    40 	if(err != KErrNone)
       
    41 		{
       
    42 		remoteFactory->SendInt(err);
       
    43 		User::Leave(err);
       
    44 		}
       
    45 	
       
    46 	// A nice litte workaround to get EASAltAlertServerResponseClearAll to be tested.
       
    47 	remoteFactory->SetServer(server);	
       
    48 
       
    49 	CleanupStack::PushL(server);
       
    50 	
       
    51 	CActiveScheduler::Start();
       
    52 	
       
    53 	CleanupStack::PopAndDestroy(3, sched);
       
    54 	}
       
    55 
       
    56 GLDEF_C TInt E32Main()
       
    57 	{
       
    58 	__UHEAP_MARK;
       
    59 	
       
    60 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    61 
       
    62 	if (!cleanup)
       
    63 		{
       
    64 		return KErrGeneral;
       
    65 		}
       
    66 
       
    67 	TRAPD(err, StartServerL());
       
    68 	delete cleanup;
       
    69 
       
    70 	__UHEAP_MARKEND;
       
    71 	return err;
       
    72 	}
       
    73