20
|
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 "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 |
|
|
19 |
#include <e32std.h>
|
|
20 |
#include <e32base.h>
|
|
21 |
#include <e32property.h>
|
|
22 |
|
|
23 |
#include <piprofiler/ProfilerTraces.h>
|
|
24 |
|
|
25 |
#include "ProfilerErrorChecker.h"
|
|
26 |
|
|
27 |
// properties
|
|
28 |
const TUid KEngineStatusPropertyCat={0x2001E5AD};
|
|
29 |
enum TEnginePropertyKeys
|
|
30 |
{
|
|
31 |
EProfilerEngineStatus = 8,
|
|
32 |
EProfilerErrorStatus
|
|
33 |
};
|
|
34 |
|
|
35 |
/*
|
|
36 |
*
|
|
37 |
* CProfilerErrorChecker class implementation
|
|
38 |
*
|
|
39 |
*/
|
|
40 |
CProfilerErrorChecker* CProfilerErrorChecker::NewL()
|
|
41 |
{
|
|
42 |
CProfilerErrorChecker* self = new(ELeave) CProfilerErrorChecker;
|
|
43 |
CleanupStack::PushL(self);
|
|
44 |
self->ConstructL();
|
|
45 |
CleanupStack::Pop();
|
|
46 |
return self;
|
|
47 |
}
|
|
48 |
|
|
49 |
// --------------------------------------------------------------------------------------------
|
|
50 |
CProfilerErrorChecker::CProfilerErrorChecker() :
|
|
51 |
CActive(EPriorityStandard)
|
|
52 |
{
|
|
53 |
}
|
|
54 |
|
|
55 |
CProfilerErrorChecker::~CProfilerErrorChecker()
|
|
56 |
{
|
|
57 |
Cancel();
|
|
58 |
iErrorStatus.Close();
|
|
59 |
}
|
|
60 |
|
|
61 |
// --------------------------------------------------------------------------------------------
|
|
62 |
void CProfilerErrorChecker::ConstructL()
|
|
63 |
{
|
|
64 |
|
|
65 |
LOGTEXT(_L("Trying to attach to profiler engine error status property"));
|
|
66 |
User::LeaveIfError(iErrorStatus.Attach(KEngineStatusPropertyCat, EProfilerErrorStatus));
|
|
67 |
CActiveScheduler::Add(this);
|
|
68 |
|
|
69 |
// subscribe to P&S status property
|
|
70 |
iErrorStatus.Subscribe(iStatus);
|
|
71 |
SetActive();
|
|
72 |
}
|
|
73 |
|
|
74 |
// --------------------------------------------------------------------------------------------
|
|
75 |
void CProfilerErrorChecker::SetObserver(MProfilerErrorObserver* aObserver)
|
|
76 |
{
|
|
77 |
iObserver = aObserver;
|
|
78 |
}
|
|
79 |
|
|
80 |
// --------------------------------------------------------------------------------------------
|
|
81 |
TInt CProfilerErrorChecker::RunError(TInt aError)
|
|
82 |
{
|
|
83 |
iErrorStatus.Close();
|
|
84 |
return aError;
|
|
85 |
}
|
|
86 |
// --------------------------------------------------------------------------------------------
|
|
87 |
void CProfilerErrorChecker::RunL()
|
|
88 |
{
|
|
89 |
// resubscribe before processing new value to prevent missing updates
|
|
90 |
iErrorStatus.Subscribe(iStatus);
|
|
91 |
SetActive();
|
|
92 |
|
|
93 |
TInt stat(0);
|
|
94 |
if(iErrorStatus.Get(stat) != KErrNone)
|
|
95 |
{
|
|
96 |
// check if error status != KErrNone
|
|
97 |
if(stat != 0)
|
|
98 |
{
|
|
99 |
iObserver->HandleProfilerErrorChangeL(stat);
|
|
100 |
}
|
|
101 |
|
|
102 |
// reset error code
|
|
103 |
iErrorStatus.Set(KErrNone);
|
|
104 |
}
|
|
105 |
}
|
|
106 |
|
|
107 |
// --------------------------------------------------------------------------------------------
|
|
108 |
|
|
109 |
void CProfilerErrorChecker::DoCancel()
|
|
110 |
{
|
|
111 |
iErrorStatus.Cancel();
|
|
112 |
}
|
|
113 |
|
|
114 |
// end of file
|
|
115 |
|