commonappservices/alarmserver/ConsoleAlarmAlertServer/Source/ConsoleAlarmAlertServerMain.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 <consolealarmalertservermain.h>
       
    17 #include <asaltdefs.h>
       
    18 #include "ConsoleAlarmAlertServer.h"
       
    19 
       
    20 TInt ConsoleAlarmAlertServer::StartServerThreadFunction(TAny* instructionSet)
       
    21 	{
       
    22 	__UHEAP_MARK;
       
    23 	//
       
    24 	CTrapCleanup* cleanup = CTrapCleanup::New();
       
    25 	if	(!cleanup)
       
    26 		User::Invariant();
       
    27 	//
       
    28 	TRAPD(err, StartServerL(instructionSet));
       
    29 	delete cleanup;
       
    30 	//
       
    31 	__UHEAP_MARKEND;
       
    32 	return err;
       
    33 	}
       
    34 
       
    35 void ConsoleAlarmAlertServer::StartServerL(TAny* instructionSet)
       
    36 	{
       
    37 	CActiveScheduler* scheduler = new CActiveScheduler();
       
    38 	CleanupStack::PushL(scheduler);
       
    39 	CActiveScheduler::Install(scheduler);
       
    40 	//
       
    41 
       
    42 	CConsoleAlarmAlertServer * tmp = CConsoleAlarmAlertServer::NewLC();
       
    43 	tmp->AddResponseArray(instructionSet);
       
    44 	RProcess::Rendezvous(KErrNone);
       
    45 	CActiveScheduler::Start();
       
    46 	//
       
    47 	CleanupStack::PopAndDestroy(2, scheduler);
       
    48 	}
       
    49 
       
    50 GLDEF_C TInt E32Main()
       
    51 	{
       
    52 	TBuf<256> cmdline;
       
    53 	RArray< TInt > buff;
       
    54 	TInt i, len, ret = KErrNone;
       
    55 
       
    56 	User::CommandLine(cmdline);
       
    57 	len = User::CommandLineLength();
       
    58 	if (len)
       
    59 		{
       
    60 		for(i=0;i<len;i++)
       
    61 			{
       
    62 		    ret = buff.Append(cmdline[i]);
       
    63 		    if (ret != KErrNone)
       
    64 		    	{
       
    65 		    	return ret;
       
    66 		    	}
       
    67 			}
       
    68 		ret = ConsoleAlarmAlertServer::StartServerThreadFunction(&buff);
       
    69         }
       
    70     else
       
    71 		{
       
    72 		ret = ConsoleAlarmAlertServer::StartServerThreadFunction();
       
    73         }
       
    74 
       
    75 	return ret;
       
    76 	}