equal
deleted
inserted
replaced
14 // |
14 // |
15 |
15 |
16 #include <centralrepository.h> |
16 #include <centralrepository.h> |
17 |
17 |
18 #include "cmtpframeworkconfig.h" |
18 #include "cmtpframeworkconfig.h" |
|
19 #include "mtpdebug.h" |
|
20 #include "OstTraceDefinitions.h" |
|
21 #ifdef OST_TRACE_COMPILER_IN_USE |
|
22 #include "cmtpframeworkconfigTraces.h" |
|
23 #endif |
|
24 |
19 |
25 |
20 /** |
26 /** |
21 CMTPFrameworkConfig factory method. |
27 CMTPFrameworkConfig factory method. |
22 @return A pointer to a new CMTPFrameworkConfig instance. Ownership IS transfered. |
28 @return A pointer to a new CMTPFrameworkConfig instance. Ownership IS transfered. |
23 @leave One of the system wide error codes if a processing failure occurs. |
29 @leave One of the system wide error codes if a processing failure occurs. |
50 { |
56 { |
51 aValue = KNullDesC; |
57 aValue = KNullDesC; |
52 } |
58 } |
53 else if (KErrNone != err) |
59 else if (KErrNone != err) |
54 { |
60 { |
|
61 OstTraceExt2( TRACE_ERROR, CMTPFRAMEWORKCONFIG_GETVALUEL_TPARAMETER_TDES, "can't get parameter(%d) value from iRepository, error code %d", aParam, err ); |
55 User::Leave(err); |
62 User::Leave(err); |
56 } |
63 } |
57 } |
64 } |
58 |
65 |
59 EXPORT_C HBufC* CMTPFrameworkConfig::ValueL(TParameter aParam) const |
66 EXPORT_C HBufC* CMTPFrameworkConfig::ValueL(TParameter aParam) const |
74 CleanupStack::Pop(); |
81 CleanupStack::Pop(); |
75 CleanupStack::PushL(buf); |
82 CleanupStack::PushL(buf); |
76 |
83 |
77 // Get the value |
84 // Get the value |
78 ptr.Set(buf->Des()); |
85 ptr.Set(buf->Des()); |
79 User::LeaveIfError(iRepository->Get(aParam, ptr)); |
86 LEAVEIFERROR(iRepository->Get(aParam, ptr), |
|
87 OstTrace1( TRACE_ERROR, CMTPFRAMEWORKCONFIG_VALUEL, "get parameter(%d) value from iRespository error!", aParam)); |
80 } |
88 } |
81 } |
89 } |
82 else if (KErrNotFound != err) |
90 else if (KErrNotFound != err) |
83 { |
91 { |
|
92 OstTraceExt2( TRACE_ERROR, DUP1_CMTPFRAMEWORKCONFIG_VALUEL, "can't get parameter(%d) value from iRepository, error code %d", aParam, err ); |
84 User::Leave(err); |
93 User::Leave(err); |
85 } |
94 } |
86 CleanupStack::Pop(buf); |
95 CleanupStack::Pop(buf); |
87 return buf; |
96 return buf; |
88 } |
97 } |
93 TInt value(0); |
102 TInt value(0); |
94 TInt err(iRepository->Get(aParam, value)); |
103 TInt err(iRepository->Get(aParam, value)); |
95 if ((KErrNone != err ) && |
104 if ((KErrNone != err ) && |
96 (KErrNotFound != err)) |
105 (KErrNotFound != err)) |
97 { |
106 { |
|
107 OstTraceExt2( TRACE_ERROR, CMTPFRAMEWORKCONFIG_GETVALUEL_TPARAMETER_TUINT, |
|
108 "can't get parameter(%d)value from iRepository, error code %d",aParam, err); |
98 User::Leave(err); |
109 User::Leave(err); |
99 } |
110 } |
100 aValue = static_cast<TUint>(value); |
111 aValue = static_cast<TUint>(value); |
101 } |
112 } |
102 |
113 |
111 { |
122 { |
112 TInt err(iRepository->Get(aParam, value)); |
123 TInt err(iRepository->Get(aParam, value)); |
113 if ((KErrNone != err ) && |
124 if ((KErrNone != err ) && |
114 (KErrNotFound != err)) |
125 (KErrNotFound != err)) |
115 { |
126 { |
|
127 OstTraceExt2( TRACE_ERROR, CMTPFRAMEWORKCONFIG_GETVALUEL_TPARAMETER_TBOOL, "can't get parameter(%d)value from iRepository, error code %d", aParam, err ); |
116 User::Leave(err); |
128 User::Leave(err); |
117 }; |
129 }; |
118 } |
130 } |
119 aValue = (value != 0); |
131 aValue = (value != 0); |
120 } |
132 } |
122 EXPORT_C void CMTPFrameworkConfig::GetValueL(TParameter aParam, RArray<TUint>& aArray) const |
134 EXPORT_C void CMTPFrameworkConfig::GetValueL(TParameter aParam, RArray<TUint>& aArray) const |
123 { |
135 { |
124 aArray.Reset(); |
136 aArray.Reset(); |
125 if (CMTPFrameworkConfig::EExcludedStorageDrives != aParam) |
137 if (CMTPFrameworkConfig::EExcludedStorageDrives != aParam) |
126 { |
138 { |
|
139 OstTrace1( TRACE_ERROR, CMTPFRAMEWORKCONFIG_GETVALUEL_TPARAMETER_RARRAY, "parameter %d not EExcludedStorageDrives", aParam); |
127 User::Leave(KErrArgument); |
140 User::Leave(KErrArgument); |
128 } |
141 } |
129 |
142 |
130 // Array settings key mask. All array settings keys must be unique that are |
143 // Array settings key mask. All array settings keys must be unique that are |
131 // unique in the most significant 2 bytes of the mask |
144 // unique in the most significant 2 bytes of the mask |
141 // Iterate the keys, retrieve the values and append them to the destination array |
154 // Iterate the keys, retrieve the values and append them to the destination array |
142 TInt count = keys.Count(); |
155 TInt count = keys.Count(); |
143 for (TInt index = 0; index < count; index++) |
156 for (TInt index = 0; index < count; index++) |
144 { |
157 { |
145 TInt value; |
158 TInt value; |
146 User::LeaveIfError(iRepository->Get(keys[index], value)); |
159 LEAVEIFERROR(iRepository->Get(keys[index], value), |
|
160 OstTrace1( TRACE_ERROR, DUP1_CMTPFRAMEWORKCONFIG_GETVALUEL_TPARAMETER_RARRAY, "can't get value from iRepository for key %d", keys[index])); |
147 aArray.AppendL(static_cast<TUint>(value)); |
161 aArray.AppendL(static_cast<TUint>(value)); |
148 } |
162 } |
149 } |
163 } |
150 else if (KErrNotFound != err) |
164 else if (KErrNotFound != err) |
151 { |
165 { |
|
166 OstTraceExt2(TRACE_ERROR, DUP2_CMTPFRAMEWORKCONFIG_GETVALUEL_TPARAMETER_RARRAY, |
|
167 "can't get parameter(%d) value from iRepository, error code %d", aParam, err ); |
152 User::Leave(err); |
168 User::Leave(err); |
153 } |
169 } |
154 |
170 |
155 CleanupStack::PopAndDestroy(&keys); |
171 CleanupStack::PopAndDestroy(&keys); |
156 } |
172 } |
174 const TInt KStartupInitValue = 1; |
190 const TInt KStartupInitValue = 1; |
175 iAbnormalDownValue = 0; |
191 iAbnormalDownValue = 0; |
176 TInt err(iRepository->Get(EAbnormalDown, iAbnormalDownValue)); |
192 TInt err(iRepository->Get(EAbnormalDown, iAbnormalDownValue)); |
177 if ((KErrNone != err ) && (KErrNotFound != err)) |
193 if ((KErrNone != err ) && (KErrNotFound != err)) |
178 { |
194 { |
|
195 OstTrace1(TRACE_ERROR, CMTPFRAMEWORKCONFIG_CONSTRUCTL, |
|
196 "can't get parameter(EAbnormalDown) value from iRepository, error code %d",err ); |
179 User::Leave(err); |
197 User::Leave(err); |
180 } |
198 } |
181 |
199 |
182 //Save the AbnormalDown state to ETrue |
200 //Save the AbnormalDown state to ETrue |
183 //if connect the phone to PC while backup, this will leave. |
201 //if connect the phone to PC while backup, this will leave. |