0
|
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 FILES
|
|
19 |
#include "cusbpnscheduler.h"
|
|
20 |
#include "cusbpnserver.h"
|
|
21 |
#include "usbpntrace.h"
|
|
22 |
|
|
23 |
#include "osttracedefinitions.h"
|
|
24 |
#ifdef OST_TRACE_COMPILER_IN_USE
|
|
25 |
#include "cusbpnschedulerTraces.h"
|
|
26 |
#endif
|
|
27 |
|
|
28 |
// EXTERNAL DATA STRUCTURES
|
|
29 |
// EXTERNAL FUNCTION PROTOTYPES
|
|
30 |
// CONSTANTS
|
|
31 |
// MACROS
|
|
32 |
// LOCAL CONSTANTS AND MACROS
|
|
33 |
// MODULE DATA STRUCTURES
|
|
34 |
// LOCAL FUNCTION PROTOTYPES
|
|
35 |
// FORWARD DECLARATIONS
|
|
36 |
|
|
37 |
// ============================= LOCAL FUNCTIONS ===============================
|
|
38 |
|
|
39 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
40 |
|
|
41 |
// -----------------------------------------------------------------------------
|
|
42 |
// CUsbPnScheduler::ConstructL
|
|
43 |
// Symbian 2nd phase constructor can leave.
|
|
44 |
// -----------------------------------------------------------------------------
|
|
45 |
//
|
|
46 |
void CUsbPnScheduler::ConstructL()
|
|
47 |
{
|
|
48 |
OstTrace0( TRACE_NORMAL, CUSBPNSCHEDULER_CONSTRUCTL_ENTRY, "CUsbPnScheduler::ConstructL" );
|
|
49 |
C_TRACE( ( _T( "CUsbPnScheduler::ConstructL()" ) ) );
|
|
50 |
|
|
51 |
/* Create active scheduler */
|
|
52 |
CUsbPnScheduler* self = new (ELeave) CUsbPnScheduler;
|
|
53 |
CleanupStack::PushL(self);
|
|
54 |
CActiveScheduler::Install( self);
|
|
55 |
|
|
56 |
TInt err( KErrNone );
|
|
57 |
|
|
58 |
/* Create USB Phonet Link server */
|
|
59 |
self->iServer = CUsbPnServer::NewL();
|
|
60 |
|
|
61 |
/* Signal error code to client */
|
|
62 |
RProcess::Rendezvous( err );
|
|
63 |
|
|
64 |
if( err )
|
|
65 |
{
|
|
66 |
TRACE_ASSERT_ALWAYS;
|
|
67 |
User::Leave( err );
|
|
68 |
}
|
|
69 |
|
|
70 |
/* Start active scheduler (Wait loop) */
|
|
71 |
CActiveScheduler::Start();
|
|
72 |
|
|
73 |
/* Active scheduler stopped */
|
|
74 |
CleanupStack::PopAndDestroy(self);
|
|
75 |
|
|
76 |
OstTrace0( TRACE_NORMAL, CUSBPNSCHEDULER_CONSTRUCTL_EXIT, "CUsbPnScheduler::ConstructL - return void" );
|
|
77 |
C_TRACE( ( _T( "CUsbPnScheduler::ConstructL() - return void" ) ) );
|
|
78 |
}
|
|
79 |
|
|
80 |
// Destructor
|
|
81 |
CUsbPnScheduler::~CUsbPnScheduler()
|
|
82 |
{
|
|
83 |
OstTrace0( TRACE_NORMAL, CUSBPNSCHEDULER_CUSBPNSCHEDULER_DESTRUCTOR_ENTRY, "CUsbPnScheduler::~CUsbPnScheduler" );
|
|
84 |
C_TRACE( ( _T( "CUsbPnScheduler::~CUsbPnScheduler()" ) ) );
|
|
85 |
|
|
86 |
if( iServer )
|
|
87 |
{
|
|
88 |
delete iServer;
|
|
89 |
}
|
|
90 |
|
|
91 |
OstTrace0( TRACE_NORMAL, CUSBPNSCHEDULER_CUSBPNSCHEDULER_DESTRUCTOR_EXIT, "CUsbPnScheduler::~CUsbPnScheduler - return" );
|
|
92 |
C_TRACE( ( _T( "CUsbPnScheduler::~CUsbPnScheduler() - return" ) ) );
|
|
93 |
}
|
|
94 |
|
|
95 |
|
|
96 |
// -----------------------------------------------------------------------------
|
|
97 |
// CUsbPnScheduler::ThreadStart
|
|
98 |
// ?implementation_description
|
|
99 |
// (other items were commented in a header).
|
|
100 |
// -----------------------------------------------------------------------------
|
|
101 |
//
|
|
102 |
|
|
103 |
TInt CUsbPnScheduler::ThreadStart( )
|
|
104 |
{
|
|
105 |
OstTrace0( TRACE_API, CUSBPNSCHEDULER_THREADSTART_ENTRY, "CUsbPnScheduler::ThreadStart" );
|
|
106 |
A_TRACE(_T("CUsbPnScheduler::ThreadStart()"));
|
|
107 |
TInt err(KErrNone);
|
|
108 |
|
|
109 |
CTrapCleanup* cleanup = CTrapCleanup::New();
|
|
110 |
|
|
111 |
#ifdef _DEBUG
|
|
112 |
// To make sure that cleanupstack will not grow before __UHEAP_MARKEND
|
|
113 |
// to prevent server panic in shut down in UDEB
|
|
114 |
TRAP( err, for( TInt i = 0; i < 20; i++) CleanupStack::PushL( ( TAny* )NULL );
|
|
115 |
CleanupStack::Pop(20);
|
|
116 |
);
|
|
117 |
#endif
|
|
118 |
|
|
119 |
if(cleanup)
|
|
120 |
{
|
|
121 |
__UHEAP_MARK;
|
|
122 |
TRAP( err, ConstructL() );
|
|
123 |
__UHEAP_MARKEND;
|
|
124 |
delete cleanup;
|
|
125 |
}
|
|
126 |
|
|
127 |
|
|
128 |
OstTrace1( TRACE_API, CUSBPNSCHEDULER_THREADSTART_EXIT, "CUsbPnScheduler::ThreadStart - return %d", err );
|
|
129 |
A_TRACE((_T("CUsbPnScheduler::ThreadStart() - return %d"), err));
|
|
130 |
return err;
|
|
131 |
}
|
|
132 |
|
|
133 |
// ========================== OTHER EXPORTED FUNCTIONS =========================
|
|
134 |
|
|
135 |
// End of File
|