author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 31 Aug 2010 16:34:26 +0300 | |
branch | RCL_3 |
changeset 256 | c1f20ce4abcf |
parent 0 | a41df078684a |
child 257 | 3e88ff8f41d5 |
child 271 | dc268b18d709 |
permissions | -rw-r--r-- |
256
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
1 |
// Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies). |
0 | 2 |
// All rights reserved. |
3 |
// This component and the accompanying materials are made available |
|
4 |
// under the terms of the License "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 |
// @file basicwatcher.cpp |
|
15 |
// @internalComponent |
|
16 |
// |
|
17 |
// |
|
18 |
||
19 |
#include "BasicWatcher.h" |
|
20 |
#include "testdebug.h" |
|
256
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
21 |
#include "OstTraceDefinitions.h" |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
22 |
#ifdef OST_TRACE_COMPILER_IN_USE |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
23 |
#include "BasicWatcherTraces.h" |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
24 |
#endif |
0 | 25 |
|
26 |
namespace NUnitTesting_USBDI |
|
27 |
{ |
|
28 |
||
29 |
CBasicWatcher::CBasicWatcher(const TCallBack& aCallBack,TInt aPriority) |
|
30 |
: CActive(aPriority), |
|
31 |
iCallBack(aCallBack), |
|
32 |
iCompletionCode(KErrNone) |
|
33 |
{ |
|
256
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
34 |
OstTraceFunctionEntryExt( CBASICWATCHER_CBASICWATCHER_ENTRY, this ); |
0 | 35 |
CActiveScheduler::Add(this); |
256
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
36 |
OstTraceFunctionExit1( CBASICWATCHER_CBASICWATCHER_EXIT, this ); |
0 | 37 |
} |
38 |
||
39 |
CBasicWatcher::~CBasicWatcher() |
|
40 |
{ |
|
256
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
41 |
OstTraceFunctionEntry1( CBASICWATCHER_CBASICWATCHER_ENTRY_DUP01, this ); |
0 | 42 |
|
43 |
Cancel(); |
|
256
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
44 |
OstTraceFunctionExit1( CBASICWATCHER_CBASICWATCHER_EXIT_DUP01, this ); |
0 | 45 |
} |
46 |
||
47 |
void CBasicWatcher::DoCancel() |
|
48 |
{ |
|
256
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
49 |
OstTraceFunctionEntry1( CBASICWATCHER_DOCANCEL_ENTRY, this ); |
0 | 50 |
|
256
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
51 |
OstTrace0(TRACE_NORMAL, CBASICWATCHER_DOCANCEL, "Watch cancelled"); |
0 | 52 |
iStatus = KErrCancel; |
256
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
53 |
OstTraceFunctionExit1( CBASICWATCHER_DOCANCEL_EXIT, this ); |
0 | 54 |
} |
55 |
||
56 |
||
57 |
void CBasicWatcher::StartWatching() |
|
58 |
{ |
|
256
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
59 |
OstTraceFunctionEntry1( CBASICWATCHER_STARTWATCHING_ENTRY, this ); |
0 | 60 |
|
61 |
if(iStatus != KRequestPending) |
|
62 |
{ |
|
63 |
User::Panic(_L("iStatus has not been set to pending this will lead to E32USER-CBase Panic"),46); |
|
64 |
} |
|
65 |
SetActive(); |
|
256
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
66 |
OstTraceFunctionExit1( CBASICWATCHER_STARTWATCHING_EXIT, this ); |
0 | 67 |
} |
68 |
||
69 |
||
70 |
void CBasicWatcher::RunL() |
|
71 |
{ |
|
256
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
72 |
OstTraceFunctionEntry1( CBASICWATCHER_RUNL_ENTRY, this ); |
0 | 73 |
|
74 |
iCompletionCode = iStatus.Int(); |
|
75 |
User::LeaveIfError(iCallBack.CallBack()); |
|
256
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
76 |
OstTraceFunctionExit1( CBASICWATCHER_RUNL_EXIT, this ); |
0 | 77 |
} |
78 |
||
79 |
||
80 |
TInt CBasicWatcher::RunError(TInt aError) |
|
81 |
{ |
|
256
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
82 |
OstTraceFunctionEntryExt( CBASICWATCHER_RUNERROR_ENTRY, this ); |
0 | 83 |
|
256
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
84 |
OstTrace1(TRACE_NORMAL, CBASICWATCHER_RUNERROR, "Watcher code Left with %d",aError); |
c1f20ce4abcf
Revision: 201035
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
85 |
OstTraceFunctionExitExt( CBASICWATCHER_RUNERROR_EXIT, this, KErrNone ); |
0 | 86 |
return KErrNone; |
87 |
} |
|
88 |
||
89 |
} |
|
90 |