189
|
1 |
/*
|
253
|
2 |
* Copyright (c) 2003-2010 Nokia Corporation and/or its subsidiary(-ies).
|
189
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "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 <e32base.h>
|
|
19 |
#include <e32test.h>
|
|
20 |
#include "transfersrv.h"
|
253
|
21 |
#include "OstTraceDefinitions.h"
|
|
22 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
23 |
#include "transfersrvmainTraces.h"
|
|
24 |
#endif
|
189
|
25 |
#include "transferserver.h"
|
|
26 |
|
|
27 |
static void RunServerL();
|
|
28 |
|
|
29 |
|
|
30 |
RTest test(_L("T_USB_TRANSFER"));
|
|
31 |
|
|
32 |
|
|
33 |
GLDEF_C TInt E32Main()
|
|
34 |
{
|
|
35 |
__UHEAP_MARK;
|
|
36 |
|
|
37 |
CTrapCleanup* cleanup = CTrapCleanup::New();
|
|
38 |
|
|
39 |
TInt ret = KErrNoMemory;
|
|
40 |
|
|
41 |
if (cleanup)
|
|
42 |
{
|
|
43 |
TRAP(ret, RunServerL());
|
|
44 |
delete cleanup;
|
|
45 |
}
|
|
46 |
|
|
47 |
__UHEAP_MARKEND;
|
|
48 |
|
|
49 |
return ret;
|
|
50 |
}
|
|
51 |
|
|
52 |
static void RunServerL()
|
|
53 |
//
|
|
54 |
// Perform all server initialisation, in particular creation of the
|
|
55 |
// scheduler and server and then run the scheduler
|
|
56 |
//
|
|
57 |
{
|
|
58 |
test.Start(_L("transfer handle"));
|
|
59 |
|
|
60 |
// naming the server thread after the server helps to debug panics
|
|
61 |
User::LeaveIfError(User::RenameThread(KTransferServerName));
|
|
62 |
//
|
|
63 |
// create and install the active scheduler we need
|
|
64 |
CActiveScheduler* scheduler = new(ELeave) CActiveScheduler;
|
|
65 |
CleanupStack::PushL(scheduler);
|
|
66 |
CActiveScheduler::Install(scheduler);
|
|
67 |
//
|
|
68 |
// create the server (leave it on the cleanup stack)
|
|
69 |
CTransferServer* server = CTransferServer::NewLC();
|
|
70 |
//
|
|
71 |
RProcess::Rendezvous(KErrNone);
|
|
72 |
|
|
73 |
//
|
|
74 |
// Ready to run
|
253
|
75 |
OstTrace0(TRACE_NORMAL, RUNSERVERL_RUNSERVERL, ">>>CActiveScheduler::Start");
|
189
|
76 |
CActiveScheduler::Start();
|
253
|
77 |
OstTrace0(TRACE_NORMAL, RUNSERVERL_RUNSERVERL_DUP01, "<<<CActiveScheduler::Start");
|
189
|
78 |
test.End();
|
|
79 |
test.Close();
|
|
80 |
|
|
81 |
//
|
|
82 |
// Cleanup the server and scheduler
|
253
|
83 |
OstTrace0(TRACE_NORMAL, RUNSERVERL_RUNSERVERL_DUP02, "tranfermain exit 1");
|
189
|
84 |
CleanupStack::PopAndDestroy(2, scheduler);
|
253
|
85 |
OstTrace0(TRACE_NORMAL, RUNSERVERL_RUNSERVERL_DUP03, "tranfermain exit 2");
|
189
|
86 |
}
|
|
87 |
|
|
88 |
//
|
|
89 |
// End of file
|