|
1 // Copyright (c) 2007-2010 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 // Implementation of Trace activation interface |
|
15 // |
|
16 |
|
17 #include "TraceCore.h" |
|
18 #include "TraceCoreTraceActivationIf.h" |
|
19 #include "BTraceOstCategoryBitmap.h" |
|
20 #include "OstTraceDefinitions.h" |
|
21 #ifdef OST_TRACE_COMPILER_IN_USE |
|
22 #include "TraceCoreTraceActivationIfTraces.h" |
|
23 #endif |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 /** |
|
29 * Constructor |
|
30 */ |
|
31 DTraceActivationIf::DTraceActivationIf() |
|
32 { |
|
33 } |
|
34 |
|
35 |
|
36 /** |
|
37 * Destructor |
|
38 */ |
|
39 DTraceActivationIf::~DTraceActivationIf() |
|
40 { |
|
41 } |
|
42 |
|
43 |
|
44 /** |
|
45 * Activate trace group |
|
46 * |
|
47 * @param aComponentId The component ID |
|
48 * @param aGroupId The group ID |
|
49 */ |
|
50 EXPORT_C void DTraceActivationIf::ActivateTrace( TUint32 aComponentId, TUint32 aGroupId ) |
|
51 { |
|
52 // Get TraceCore |
|
53 DTraceCore* traceCore = DTraceCore::GetInstance(); |
|
54 if ( traceCore != NULL ) |
|
55 { |
|
56 MTraceCoreActivation* activation = traceCore->GetActivation( aComponentId ); |
|
57 if ( activation != NULL ) |
|
58 { |
|
59 activation->ActivateTrace( aComponentId, aGroupId ); |
|
60 } |
|
61 } |
|
62 } |
|
63 |
|
64 |
|
65 /** |
|
66 * Deactivate trace group |
|
67 * |
|
68 * @param aComponentId The component ID |
|
69 * @param aGroupId The group ID |
|
70 */ |
|
71 EXPORT_C void DTraceActivationIf::DeactivateTrace( TUint32 aComponentId, TUint32 aGroupId ) |
|
72 { |
|
73 OstTraceExt2( TRACE_BORDER, DTRACEACTIVATIONIF_DEACTIVATETRACE_ENTRY,"> DTraceActivationIf::DeactivateTrace. CID:0x%x GID:0x%x", aComponentId, aGroupId ); |
|
74 // Get TraceCore |
|
75 DTraceCore* traceCore = DTraceCore::GetInstance(); |
|
76 if ( traceCore != NULL ) |
|
77 { |
|
78 MTraceCoreActivation* activation = traceCore->GetActivation( aComponentId ); |
|
79 if ( activation != NULL ) |
|
80 { |
|
81 activation->DeactivateTrace( aComponentId, aGroupId ); |
|
82 } |
|
83 } |
|
84 |
|
85 } |
|
86 |
|
87 /** |
|
88 * Check if a Trace is activated for the supplied component and group id |
|
89 * |
|
90 * @param aComponentId The component ID |
|
91 * @param aGroupId The group ID |
|
92 * @return returns ETrue if trace is activated otherwise EFalse |
|
93 */ |
|
94 EXPORT_C TBool DTraceActivationIf::IsTraceActivated(TUint32 aComponentId, TUint32 aGroupId) |
|
95 { |
|
96 TBool ret = EFalse; |
|
97 |
|
98 DTraceCore* traceCore = DTraceCore::GetInstance(); |
|
99 if (traceCore != NULL) |
|
100 { |
|
101 MTraceCoreActivation* activation = traceCore->GetActivation(aComponentId); |
|
102 if (activation != NULL) |
|
103 { |
|
104 if(activation->IsComponentSupported(aComponentId)) |
|
105 { |
|
106 RArray<TUint> groups = activation->GetActivatedGroups(aComponentId); |
|
107 |
|
108 const TUint8 KGroupId = (TUint8)aGroupId; |
|
109 |
|
110 for(TInt i=0;i<groups.Count();i++) |
|
111 { |
|
112 if( (TUint8)groups[i] == KGroupId) |
|
113 { |
|
114 ret = ETrue; |
|
115 break; |
|
116 } |
|
117 } |
|
118 } |
|
119 } |
|
120 else |
|
121 { |
|
122 OstTrace0(TRACE_IMPORTANT,DTRACEACTIVATIONIF_DEACTIVATETRACE_NO_ACTIVATION,"DTraceActivationIf::IsTraceActivated - No activation interface"); |
|
123 } |
|
124 } |
|
125 else |
|
126 { |
|
127 OstTrace0(TRACE_IMPORTANT,DTRACEACTIVATIONIF_DEACTIVATETRACE_NULL_TRACECORE,"DTraceActivationIf::IsTraceActivated - NULL TraceCore"); |
|
128 } |
|
129 |
|
130 return ret; |
|
131 } |
|
132 |
|
133 |
|
134 /** |
|
135 * Reactivate all currently activated traces |
|
136 * |
|
137 * @return KErrNone if refresh successful |
|
138 */ |
|
139 EXPORT_C TInt DTraceActivationIf::RefreshActivations() |
|
140 { |
|
141 // Get TraceCore |
|
142 DTraceCore* traceCore = DTraceCore::GetInstance(); |
|
143 if ( traceCore != NULL ) |
|
144 { |
|
145 return traceCore->RefreshActivations(); |
|
146 } |
|
147 return KErrNotReady; |
|
148 } |
|
149 |