192 // CApUtils::WapBearerTypeL |
106 // CApUtils::WapBearerTypeL |
193 // --------------------------------------------------------- |
107 // --------------------------------------------------------- |
194 // |
108 // |
195 EXPORT_C void CApUtils::WapBearerTypeL( TUint32 aUid, TDes& aBearer ) |
109 EXPORT_C void CApUtils::WapBearerTypeL( TUint32 aUid, TDes& aBearer ) |
196 { |
110 { |
197 CLOG( ( EUtil, 0, _L( "-> CApUtils::WapBearerTypeL" ) ) ); |
|
198 |
|
199 TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb ); |
|
200 |
|
201 DoWapBearerTypeL( aUid, aBearer ); |
|
202 |
|
203 if ( ownTransaction ) |
|
204 { |
|
205 ApCommons::CommitTransaction( *iDb ); |
|
206 CleanupStack::Pop(); // RollbackTransactionOnLeave |
|
207 } |
|
208 |
|
209 CLOG( ( EUtil, 1, _L( "<- CApUtils::WapBearerTypeL" ) ) ); |
|
210 } |
111 } |
211 |
112 |
212 |
113 |
213 // --------------------------------------------------------- |
114 // --------------------------------------------------------- |
214 // CApUtils::BearerTypeL |
115 // CApUtils::BearerTypeL |
215 // --------------------------------------------------------- |
116 // --------------------------------------------------------- |
216 // |
117 // |
217 EXPORT_C TApBearerType CApUtils::BearerTypeL( TUint32 aUid ) |
118 EXPORT_C TApBearerType CApUtils::BearerTypeL( TUint32 aUid ) |
218 { |
119 { |
219 CLOG( ( EUtil, 0, _L( "-> CApUtils::BearerTypeL" ) ) ); |
120 User::Leave( KErrNotSupported ); |
220 |
|
221 TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb ); |
|
222 TApBearerType retval = EApBearerTypeAllBearers; |
|
223 retval = DoBearerTypeL( aUid ); |
|
224 if ( ownTransaction ) |
|
225 { |
|
226 ApCommons::CommitTransaction( *iDb ); |
|
227 CleanupStack::Pop(); // RollbackTransactionOnLeave |
|
228 } |
|
229 |
|
230 CLOG( ( EUtil, 1, _L( "<- CApUtils::BearerTypeL" ) ) ); |
|
231 return retval; |
|
232 } |
121 } |
233 |
122 |
234 |
123 |
235 // --------------------------------------------------------- |
124 // --------------------------------------------------------- |
236 // CApUtils::ISPTypeL |
125 // CApUtils::ISPTypeL |
237 // --------------------------------------------------------- |
126 // --------------------------------------------------------- |
238 // |
127 // |
239 EXPORT_C void CApUtils::ISPTypeL( TUint32 aUid, TCommsDbIspType& aIspType ) |
128 EXPORT_C void CApUtils::ISPTypeL( TUint32 aUid, TCommsDbIspType& aIspType ) |
240 { |
129 { |
241 CLOG( ( EUtil, 0, _L( "-> CApUtils::ISPTypeL" ) ) ); |
|
242 |
|
243 TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb ); |
|
244 DoISPTypeL( aUid, aIspType ); |
|
245 if ( ownTransaction ) |
|
246 { |
|
247 ApCommons::CommitTransaction( *iDb ); |
|
248 CleanupStack::Pop(); // RollbackTransactionOnLeave |
|
249 } |
|
250 |
|
251 CLOG( ( EUtil, 1, _L( "<- CApUtils::ISPTypeL" ) ) ); |
|
252 } |
130 } |
253 |
131 |
254 |
132 |
255 |
133 |
256 // --------------------------------------------------------- |
134 // --------------------------------------------------------- |
257 // CApUtils::IsValidNameL |
135 // CApUtils::IsValidNameL |
258 // --------------------------------------------------------- |
136 // --------------------------------------------------------- |
259 // |
137 // |
260 EXPORT_C TBool CApUtils::IsValidNameL( const TDesC& aNameText ) |
138 EXPORT_C TBool CApUtils::IsValidNameL( const TDesC& aNameText ) |
261 { |
139 { |
262 CLOG( ( EUtil, 0, _L( "<-> CApUtils::IsValidNameL" ) ) ); |
140 return EFalse; |
263 |
|
264 return IsValidNameL( aNameText, 0 ); |
|
265 } |
141 } |
266 |
142 |
267 |
143 |
268 // --------------------------------------------------------- |
144 // --------------------------------------------------------- |
269 // CApUtils::MakeValidName |
145 // CApUtils::MakeValidName |
270 // --------------------------------------------------------- |
146 // --------------------------------------------------------- |
271 // |
147 // |
272 EXPORT_C TBool CApUtils::MakeValidNameL( TDes& aNameText ) |
148 EXPORT_C TBool CApUtils::MakeValidNameL( TDes& aNameText ) |
273 { |
149 { |
274 CLOG( ( EUtil, 0, _L( "-> CApUtils::MakeValidNameL" ) ) ); |
150 return EFalse; |
275 |
|
276 TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb ); |
|
277 |
|
278 HBufC* buf = HBufC::NewLC( KModifiableTextLength ); |
|
279 TPtr ptr( buf->Des() ); |
|
280 ptr.Copy( aNameText ); |
|
281 TBool nameChanged( EFalse ); |
|
282 HBufC* sgd = ApCommons::DoMakeValidNameL( *iDb, |
|
283 nameChanged, |
|
284 buf, |
|
285 0, |
|
286 EFalse ); |
|
287 |
|
288 if ( nameChanged ) |
|
289 { |
|
290 aNameText.Copy( *sgd ); |
|
291 } |
|
292 CleanupStack::PopAndDestroy( buf ); // buf |
|
293 delete sgd; |
|
294 if ( ownTransaction ) |
|
295 { |
|
296 ApCommons::CommitTransaction( *iDb ); |
|
297 CleanupStack::Pop(); // RollbackTransactionOnLeave |
|
298 } |
|
299 |
|
300 CLOG( ( EUtil, 1, _L( "<- CApUtils::MakeValidNameL" ) ) ); |
|
301 return nameChanged; |
|
302 } |
151 } |
303 |
152 |
304 |
153 |
305 // --------------------------------------------------------- |
154 // --------------------------------------------------------- |
306 // CApUtils::NameL |
155 // CApUtils::NameL |
307 // --------------------------------------------------------- |
156 // --------------------------------------------------------- |
308 // |
157 // |
309 EXPORT_C void CApUtils::NameL( TUint32 aUid, TDes& aName ) |
158 EXPORT_C void CApUtils::NameL( TUint32 aUid, TDes& aName ) |
310 { |
159 { |
311 CLOG( ( EUtil, 0, _L( "-> CApUtils::NameL" ) ) ); |
|
312 |
|
313 TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb ); |
|
314 DoNameL( aUid, aName ); |
|
315 if ( ownTransaction ) |
|
316 { |
|
317 ApCommons::CommitTransaction( *iDb ); |
|
318 CleanupStack::Pop(); // RollbackTransactionOnLeave |
|
319 } |
|
320 |
|
321 CLOG( ( EUtil, 1, _L( "<- CApUtils::NameL" ) ) ); |
|
322 } |
160 } |
323 |
161 |
324 |
162 |
325 |
163 |
326 // --------------------------------------------------------- |
164 // --------------------------------------------------------- |
327 // CApUtils::SetNameL |
165 // CApUtils::SetNameL |
328 // --------------------------------------------------------- |
166 // --------------------------------------------------------- |
329 // |
167 // |
330 EXPORT_C void CApUtils::SetNameL( TDes& aName, TUint32 aUid ) |
168 EXPORT_C void CApUtils::SetNameL( TDes& aName, TUint32 aUid ) |
331 { |
169 { |
332 CLOG( ( EUtil, 0, _L( "-> CApUtils::SetNameL" ) ) ); |
|
333 |
|
334 if ( iExt->iVariant & KApUiEditOnlyVPNs ) |
|
335 { |
|
336 User::Leave( KErrNotSupported ); |
|
337 } |
|
338 |
|
339 TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb ); |
|
340 DoSetNameL( aName, aUid ); |
|
341 if ( ownTransaction ) |
|
342 { |
|
343 ApCommons::CommitTransaction( *iDb ); |
|
344 CleanupStack::Pop(); // RollbackTransactionOnLeave |
|
345 } |
|
346 |
|
347 CLOG( ( EUtil, 1, _L( "<- CApUtils::SetNameL" ) ) ); |
|
348 } |
170 } |
349 |
171 |
350 |
172 |
351 |
173 |
352 // --------------------------------------------------------- |
174 // --------------------------------------------------------- |
353 // CApUtils::SetISPTypeL |
175 // CApUtils::SetISPTypeL |
354 // --------------------------------------------------------- |
176 // --------------------------------------------------------- |
355 // |
177 // |
356 EXPORT_C void CApUtils::SetISPTypeL( TUint32 aUid, TCommsDbIspType aIspType ) |
178 EXPORT_C void CApUtils::SetISPTypeL( TUint32 aUid, TCommsDbIspType aIspType ) |
357 { |
179 { |
358 CLOG( ( EUtil, 0, _L( "-> CApUtils::SetISPTypeL" ) ) ); |
|
359 |
|
360 if ( iExt->iVariant & KApUiEditOnlyVPNs ) |
|
361 { |
|
362 User::Leave( KErrNotSupported ); |
|
363 } |
|
364 |
|
365 TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb ); |
|
366 DoSetISPTypeL( aUid, aIspType ); |
|
367 if ( ownTransaction ) |
|
368 { |
|
369 ApCommons::CommitTransaction( *iDb ); |
|
370 CleanupStack::Pop(); // RollbackTransactionOnLeave |
|
371 } |
|
372 |
|
373 CLOG( ( EUtil, 1, _L( "<- CApUtils::SetISPTypeL" ) ) ); |
|
374 } |
180 } |
375 |
181 |
376 |
182 |
377 |
183 |
378 // --------------------------------------------------------- |
184 // --------------------------------------------------------- |
379 // CApUtils::IapIdFromWapIdL |
185 // CApUtils::IapIdFromWapIdL |
380 // --------------------------------------------------------- |
186 // --------------------------------------------------------- |
381 // |
187 // |
382 EXPORT_C TUint32 CApUtils::IapIdFromWapIdL( TUint32 aUid ) |
188 EXPORT_C TUint32 CApUtils::IapIdFromWapIdL( TUint32 aUid ) |
383 { |
189 { |
384 CLOG( ( EUtil, 0, _L( "-> CApUtils::IapIdFromWapIdL" ) ) ); |
190 return 0; |
385 |
|
386 TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb ); |
|
387 TUint32 retval( 0 ); |
|
388 |
|
389 CCommsDbTableView* wapt; |
|
390 wapt = iDb->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT), |
|
391 TPtrC(COMMDB_ID), aUid ); |
|
392 User::LeaveIfError( wapt->GotoFirstRecord() ); |
|
393 |
|
394 HBufC* wapBearer = ApCommons::ReadText16ValueLC |
|
395 ( |
|
396 wapt, |
|
397 TPtrC(WAP_CURRENT_BEARER) |
|
398 ); |
|
399 |
|
400 if ( *wapBearer == TPtrC(WAP_IP_BEARER) ) |
|
401 { |
|
402 CCommsDbTableView* bearert; |
|
403 bearert = iDb->OpenViewMatchingUintLC( TPtrC(*wapBearer), |
|
404 TPtrC(WAP_ACCESS_POINT_ID), aUid ); |
|
405 User::LeaveIfError( bearert->GotoFirstRecord() ); |
|
406 ApCommons::ReadUintL( bearert, TPtrC(WAP_IAP), retval ); |
|
407 CleanupStack::PopAndDestroy( bearert ); // bearert |
|
408 } |
|
409 else |
|
410 { |
|
411 User::Leave( KErrInvalidBearerType ); |
|
412 } |
|
413 CleanupStack::PopAndDestroy( 2, wapt ); // wapBearer, wapt |
|
414 if ( ownTransaction ) |
|
415 { |
|
416 ApCommons::CommitTransaction( *iDb ); |
|
417 CleanupStack::Pop(); // RollbackTransactionOnLeave |
|
418 } |
|
419 |
|
420 CLOG( ( EUtil, 1, _L( "<- CApUtils::IapIdFromWapIdL" ) ) ); |
|
421 return retval; |
|
422 } |
191 } |
423 |
192 |
424 |
193 |
425 // --------------------------------------------------------- |
194 // --------------------------------------------------------- |
426 // CApUtils::WapIdFromIapIdL |
195 // CApUtils::WapIdFromIapIdL |
427 // --------------------------------------------------------- |
196 // --------------------------------------------------------- |
428 // |
197 // |
429 EXPORT_C TUint32 CApUtils::WapIdFromIapIdL( TUint32 aUid ) |
198 EXPORT_C TUint32 CApUtils::WapIdFromIapIdL( TUint32 aUid ) |
430 { |
199 { |
431 CLOG( ( EUtil, 0, _L( "-> CApUtils::WapIdFromIapIdL" ) ) ); |
200 return 0; |
432 |
|
433 TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb ); |
|
434 TUint32 retval( 0 ); |
|
435 |
|
436 CCommsDbTableView* bearert; |
|
437 bearert = iDb->OpenViewMatchingUintLC( TPtrC(WAP_IP_BEARER), |
|
438 TPtrC(WAP_IAP), aUid ); |
|
439 User::LeaveIfError( bearert->GotoFirstRecord() ); |
|
440 ApCommons::ReadUintL( bearert, TPtrC(WAP_ACCESS_POINT_ID), retval ); |
|
441 CleanupStack::PopAndDestroy( bearert ); // bearert |
|
442 |
|
443 if ( ownTransaction ) |
|
444 { |
|
445 ApCommons::CommitTransaction( *iDb ); |
|
446 CleanupStack::Pop(); // RollbackTransactionOnLeave |
|
447 } |
|
448 |
|
449 CLOG( ( EUtil, 1, _L( "<- CApUtils::WapIdFromIapIdL" ) ) ); |
|
450 return retval; |
|
451 } |
201 } |
452 |
202 |
453 |
203 |
454 // --------------------------------------------------------- |
204 // --------------------------------------------------------- |
455 // CApUtils::HasMandatoryFieldsFilledL |
205 // CApUtils::HasMandatoryFieldsFilledL |
456 // --------------------------------------------------------- |
206 // --------------------------------------------------------- |
457 // |
207 // |
458 EXPORT_C TBool CApUtils::HasMandatoryFieldsFilledL( TUint32 aUid ) |
208 EXPORT_C TBool CApUtils::HasMandatoryFieldsFilledL( TUint32 aUid ) |
459 { |
209 { |
460 CLOG( ( EUtil, 0, _L( "-> CApUtils::HasMandatoryFieldsFilledL" ) ) ); |
210 return EFalse; |
461 |
|
462 TBool retval( EFalse ); |
|
463 TBool isOwn = ApCommons::StartPushedTransactionLC( *iDb ); |
|
464 retval= DoHasMandatoryFieldsFilledL( aUid ); |
|
465 if ( isOwn ) |
|
466 { |
|
467 ApCommons::CommitTransaction( *iDb ); |
|
468 CleanupStack::Pop(); // RollbackTransactionOnLeave |
|
469 } |
|
470 |
|
471 CLOG( ( EUtil, 1, _L( "<- CApUtils::HasMandatoryFieldsFilledL" ) ) ); |
|
472 return retval; |
|
473 } |
211 } |
474 |
212 |
475 |
213 |
476 |
214 |
477 // --------------------------------------------------------- |
215 // --------------------------------------------------------- |
478 // CApUtils::IAPExistsL |
216 // CApUtils::IAPExistsL |
479 // --------------------------------------------------------- |
217 // --------------------------------------------------------- |
480 // |
218 // |
481 EXPORT_C TBool CApUtils::IAPExistsL( TUint32 aUid ) |
219 EXPORT_C TBool CApUtils::IAPExistsL( TUint32 aUid ) |
482 { |
220 { |
483 CLOG( ( EUtil, 0, _L( "<-> CApUtils::IAPExistsL" ) ) ); |
221 return EFalse; |
484 |
|
485 return DoesExistsL( TPtrC( IAP ), aUid ); |
|
486 } |
222 } |
487 |
223 |
488 |
224 |
489 // --------------------------------------------------------- |
225 // --------------------------------------------------------- |
490 // CApUtils::WapApExistsL |
226 // CApUtils::WapApExistsL |
491 // --------------------------------------------------------- |
227 // --------------------------------------------------------- |
492 // |
228 // |
493 EXPORT_C TBool CApUtils::WapApExistsL( TUint32 aUid ) |
229 EXPORT_C TBool CApUtils::WapApExistsL( TUint32 aUid ) |
494 { |
230 { |
495 CLOG( ( EUtil, 0, _L( "<-> CApUtils::WapApExistsL" ) ) ); |
231 return EFalse; |
496 |
|
497 return DoesExistsL( TPtrC( WAP_ACCESS_POINT ), aUid ); |
|
498 } |
232 } |
499 |
233 |
500 |
234 |
501 |
235 |
502 // --------------------------------------------------------- |
236 // --------------------------------------------------------- |
761 // CApUtils::DoWapBearerTypeL |
297 // CApUtils::DoWapBearerTypeL |
762 // --------------------------------------------------------- |
298 // --------------------------------------------------------- |
763 // |
299 // |
764 void CApUtils::DoWapBearerTypeL( TUint32 aUid, TDes& aBearer ) |
300 void CApUtils::DoWapBearerTypeL( TUint32 aUid, TDes& aBearer ) |
765 { |
301 { |
766 CLOG( ( EUtil, 0, _L( "-> CApUtils::DoWapBearerTypeL" ) ) ); |
|
767 |
|
768 CCommsDbTableView* wapt; |
|
769 wapt = iDb->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT), |
|
770 TPtrC(COMMDB_ID), aUid ); |
|
771 User::LeaveIfError( wapt->GotoFirstRecord() ); |
|
772 HBufC* wapBearer = ApCommons::ReadText16ValueLC |
|
773 ( |
|
774 wapt, |
|
775 TPtrC(WAP_CURRENT_BEARER) |
|
776 ); |
|
777 if ( aBearer.MaxLength() < wapBearer->Length() ) |
|
778 { |
|
779 User::Leave( KErrDescOverflow ); |
|
780 } |
|
781 else |
|
782 { |
|
783 aBearer.SetLength( wapBearer->Length() ); |
|
784 aBearer.Format( KFormat, &*wapBearer ); |
|
785 } |
|
786 CleanupStack::PopAndDestroy( 2, wapt ); // wapBearer, wapt |
|
787 |
|
788 CLOG( ( EUtil, 1, _L( "<- CApUtils::DoWapBearerTypeL" ) ) ); |
|
789 } |
302 } |
790 |
303 |
791 |
304 |
792 |
305 |
793 // --------------------------------------------------------- |
306 // --------------------------------------------------------- |
794 // CApUtils::DoBearerTypeL |
307 // CApUtils::DoBearerTypeL |
795 // --------------------------------------------------------- |
308 // --------------------------------------------------------- |
796 // |
309 // |
797 TApBearerType CApUtils::DoBearerTypeL( TUint32 aUid ) |
310 TApBearerType CApUtils::DoBearerTypeL( TUint32 aUid ) |
798 { |
311 { |
799 CLOG( ( EUtil, 0, _L( "-> CApUtils::DoBearerTypeL" ) ) ); |
312 User::Leave( KErrNotSupported ); |
800 |
|
801 TApBearerType retval = EApBearerTypeAllBearers; |
|
802 |
|
803 CCommsDbTableView* wapt; |
|
804 wapt = iDb->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT), |
|
805 TPtrC(COMMDB_ID), |
|
806 aUid ); |
|
807 |
|
808 // TRAPped for some record that doesn't have a WAP -table. |
|
809 // If KErrNotFound, then just return EApBearerTypeWLAN |
|
810 TInt wapErr = wapt->GotoFirstRecord(); |
|
811 if ( wapErr == KErrNotFound ) |
|
812 { |
|
813 CleanupStack::PopAndDestroy( wapt ); |
|
814 return EApBearerTypeWLAN; |
|
815 } |
|
816 else |
|
817 { |
|
818 User::LeaveIfError( wapErr ); |
|
819 } |
|
820 |
|
821 HBufC* wapBearer = ApCommons::ReadText16ValueLC |
|
822 ( |
|
823 wapt, |
|
824 TPtrC(WAP_CURRENT_BEARER) |
|
825 ); |
|
826 |
|
827 CCommsDbTableView* bearert = iDb->OpenViewMatchingUintLC( *wapBearer, |
|
828 TPtrC(WAP_ACCESS_POINT_ID), aUid ); |
|
829 |
|
830 User::LeaveIfError( bearert->GotoFirstRecord() ); |
|
831 // decide which bearer, read bearer spec. data. |
|
832 if ( *wapBearer == TPtrC(WAP_IP_BEARER) ) |
|
833 { |
|
834 TUint32 wapIap; |
|
835 ApCommons::ReadUintL( bearert, TPtrC(WAP_IAP), wapIap ); |
|
836 |
|
837 CCommsDbTableView* iapt = iDb->OpenViewMatchingUintLC( TPtrC(IAP), |
|
838 TPtrC(COMMDB_ID), wapIap ); |
|
839 |
|
840 User::LeaveIfError( iapt->GotoFirstRecord() ); |
|
841 HBufC* aIapServiceType = ApCommons::ReadText16ValueLC |
|
842 ( |
|
843 iapt, |
|
844 TPtrC(IAP_SERVICE_TYPE) |
|
845 ); |
|
846 if ( ( *aIapServiceType == TPtrC(DIAL_OUT_ISP) ) || |
|
847 ( *aIapServiceType == TPtrC(DIAL_IN_ISP) ) ) |
|
848 { |
|
849 // need to get 'speed' data ( HS or normal CSD ) |
|
850 TUint32 wapIsp; |
|
851 ApCommons::ReadUintL( iapt, TPtrC(IAP_SERVICE), wapIsp ); |
|
852 CCommsDbTableView* ispt = iDb->OpenViewMatchingUintLC( |
|
853 *aIapServiceType, |
|
854 TPtrC(COMMDB_ID), |
|
855 wapIsp ); |
|
856 User::LeaveIfError( ispt->GotoFirstRecord() ); |
|
857 TUint32 bear; |
|
858 if ( ApCommons::ReadUintL( ispt, TPtrC(ISP_BEARER_TYPE), bear ) |
|
859 == KErrUnknown ) |
|
860 { |
|
861 bear = EBearerTypeCSD; |
|
862 } |
|
863 if ( bear == EBearerTypeCSD ) |
|
864 { |
|
865 retval = EApBearerTypeCSD; |
|
866 } |
|
867 else |
|
868 { |
|
869 if ( bear == EBearerTypeHSCSD ) |
|
870 { |
|
871 retval = EApBearerTypeHSCSD; |
|
872 } |
|
873 else |
|
874 { |
|
875 User::Leave( KErrInvalidBearer ); |
|
876 } |
|
877 } |
|
878 CleanupStack::PopAndDestroy( ispt ); // ispt |
|
879 } |
|
880 else |
|
881 { |
|
882 if ( ( *aIapServiceType == TPtrC(OUTGOING_WCDMA) ) || |
|
883 ( *aIapServiceType == TPtrC(INCOMING_WCDMA) ) ) |
|
884 { |
|
885 retval = EApBearerTypeGPRS; |
|
886 } |
|
887 else |
|
888 { // some other bearer, currently it might be VPN or WLAN |
|
889 if ( *aIapServiceType == TPtrC(VPN_SERVICE) ) |
|
890 { // Get real VPN bearertype... |
|
891 TUint32 service; |
|
892 ApCommons::ReadUintL( iapt, TPtrC(IAP_SERVICE), service ); |
|
893 |
|
894 CCommsDbTableView* ispt; |
|
895 ispt = iDb->OpenViewMatchingUintLC( TPtrC(VPN_SERVICE), |
|
896 TPtrC(COMMDB_ID), |
|
897 service ); |
|
898 User::LeaveIfError( ispt->GotoFirstRecord() ); |
|
899 TUint32 tempint; |
|
900 HBufC* buf = NULL; |
|
901 // get the real iap |
|
902 ApCommons::ReadUintL( ispt, |
|
903 TPtrC(VPN_SERVICE_IAP), |
|
904 tempint ); |
|
905 |
|
906 // now open the real IAP an get it's bearer... |
|
907 CCommsDbTableView* iapt2 = NULL; |
|
908 iapt2 = iDb->OpenViewMatchingUintLC( TPtrC(IAP), |
|
909 TPtrC(COMMDB_ID), |
|
910 tempint ); |
|
911 User::LeaveIfError( iapt2->GotoFirstRecord() ); |
|
912 |
|
913 buf = ApCommons::ReadText16ValueLC( iapt2, |
|
914 TPtrC(IAP_SERVICE_TYPE) ); |
|
915 TUint32 service2; |
|
916 ApCommons::ReadUintL( iapt2, TPtrC(IAP_SERVICE), |
|
917 service2 ); |
|
918 |
|
919 if ( ( buf->Compare( TPtrC(OUTGOING_WCDMA ) ) == 0 ) || |
|
920 ( buf->Compare( TPtrC(INCOMING_WCDMA ) ) == 0 ) ) |
|
921 { |
|
922 retval = EApBearerTypeGPRS; |
|
923 } |
|
924 else |
|
925 { |
|
926 if ( ( buf->Compare( TPtrC(DIAL_OUT_ISP ) ) == 0 ) || |
|
927 ( buf->Compare( TPtrC(DIAL_IN_ISP ) ) == 0 ) ) |
|
928 { |
|
929 // need to get ISP, |
|
930 CCommsDbTableView* doutt = NULL; |
|
931 doutt = iDb->OpenViewMatchingUintLC( |
|
932 *buf, |
|
933 TPtrC(COMMDB_ID), |
|
934 service2 ); |
|
935 |
|
936 User::LeaveIfError( doutt ->GotoFirstRecord() ); |
|
937 ApCommons::ReadUintL( doutt , |
|
938 TPtrC(ISP_BEARER_TYPE), |
|
939 tempint ); |
|
940 if ( tempint == EBearerTypeCSD ) |
|
941 { |
|
942 retval = EApBearerTypeCSD; |
|
943 } |
|
944 else |
|
945 { |
|
946 retval = EApBearerTypeHSCSD; |
|
947 } |
|
948 CleanupStack::PopAndDestroy( doutt ); // doutt |
|
949 } |
|
950 else |
|
951 { |
|
952 // VPN, having a bearer something |
|
953 // else than CSD, HSCSD & GPRS? |
|
954 // check for WLAN |
|
955 if ( iExt->iWlanSupported ) |
|
956 { |
|
957 if ( buf->Compare( TPtrC(LAN_SERVICE) ) == 0 ) |
|
958 { // LAN or WLAN |
|
959 if ( IsWlanL( service2 ) ) |
|
960 { |
|
961 retval = EApBearerTypeWLAN; |
|
962 } |
|
963 else |
|
964 { |
|
965 User::Leave( KErrInvalidBearer ); |
|
966 } |
|
967 } |
|
968 else |
|
969 { |
|
970 User::Leave( KErrInvalidBearer ); |
|
971 } |
|
972 } |
|
973 else |
|
974 { |
|
975 User::Leave( KErrInvalidBearer ); |
|
976 } |
|
977 } |
|
978 } |
|
979 CleanupStack::PopAndDestroy( 3, ispt ); // buf, iapt2, ispt |
|
980 } |
|
981 else |
|
982 { // other, but not VPN, check for WLAN |
|
983 if ( iExt->iWlanSupported ) |
|
984 { |
|
985 if ( *aIapServiceType == TPtrC(LAN_SERVICE) ) |
|
986 { // check existence... |
|
987 TUint32 service; |
|
988 TUint32 bearer; |
|
989 ApCommons::ReadUintL( iapt, TPtrC(IAP_SERVICE), |
|
990 service ); |
|
991 ApCommons::ReadUintL( iapt, TPtrC(IAP_BEARER), |
|
992 bearer ); |
|
993 |
|
994 |
|
995 CCommsDbTableView* ispt; |
|
996 ispt = iDb->OpenViewMatchingUintLC( |
|
997 TPtrC(LAN_SERVICE), |
|
998 TPtrC(COMMDB_ID), |
|
999 service ); |
|
1000 User::LeaveIfError( ispt->GotoFirstRecord() ); |
|
1001 // now we know it is either WLAN or some kinda LAN |
|
1002 if ( IsWlanL( service ) ) |
|
1003 { |
|
1004 retval = EApBearerTypeWLAN; |
|
1005 } |
|
1006 else |
|
1007 { // other, |
|
1008 // check for LANModem first, then for LAN |
|
1009 CCommsDbTableView* lanbearer; |
|
1010 lanbearer = |
|
1011 iDb->OpenViewMatchingUintLC( |
|
1012 TPtrC(LAN_BEARER), |
|
1013 TPtrC(COMMDB_ID), |
|
1014 bearer ); |
|
1015 User::LeaveIfError( |
|
1016 lanbearer->GotoFirstRecord() ); |
|
1017 // LANMODEM? check commdb_name |
|
1018 HBufC* lbuf; |
|
1019 lbuf = ApCommons::ReadText16ValueLC( lanbearer, |
|
1020 TPtrC(COMMDB_NAME) ); |
|
1021 // if it is KModemBearerLANModem, |
|
1022 // it is LANModem |
|
1023 if ( *lbuf == KModemBearerLANModem ) |
|
1024 { |
|
1025 retval = EApBearerTypeLANModem; |
|
1026 } |
|
1027 else |
|
1028 { |
|
1029 #ifdef __TEST_LAN_BEARER |
|
1030 // LAN? |
|
1031 if ( *lbuf == KModemBearerLAN ) |
|
1032 { |
|
1033 retval = EApBearerTypeLAN; |
|
1034 } |
|
1035 else |
|
1036 { |
|
1037 // other, but not VPN, or not supported |
|
1038 User::Leave( KErrInvalidBearer ); |
|
1039 } |
|
1040 #else |
|
1041 // other, but not VPN, or not supported |
|
1042 User::Leave( KErrInvalidBearer ); |
|
1043 #endif // __TEST_LAN_BEARER |
|
1044 } |
|
1045 CleanupStack::PopAndDestroy( lbuf ); |
|
1046 CleanupStack::PopAndDestroy( lanbearer ); |
|
1047 } |
|
1048 CleanupStack::PopAndDestroy( ispt ); |
|
1049 } |
|
1050 } |
|
1051 else |
|
1052 { |
|
1053 #ifdef __TEST_LAN_BEARER |
|
1054 if ( *aIapServiceType == TPtrC(LAN_SERVICE) ) |
|
1055 { // check existence... |
|
1056 TUint32 service; |
|
1057 TUint32 bearer; |
|
1058 ApCommons::ReadUintL( iapt, TPtrC(IAP_SERVICE), |
|
1059 service ); |
|
1060 ApCommons::ReadUintL( iapt, TPtrC(IAP_BEARER), |
|
1061 bearer ); |
|
1062 |
|
1063 CCommsDbTableView* ispt; |
|
1064 ispt = iDb->OpenViewMatchingUintLC( |
|
1065 TPtrC(LAN_SERVICE), |
|
1066 TPtrC(COMMDB_ID), |
|
1067 service ); |
|
1068 User::LeaveIfError( ispt->GotoFirstRecord() ); |
|
1069 // now we know it is some kinda LAN |
|
1070 // check for LANModem first, then for LAN |
|
1071 CCommsDbTableView* lanbearer; |
|
1072 lanbearer = |
|
1073 iDb->OpenViewMatchingUintLC( |
|
1074 TPtrC(LAN_BEARER), |
|
1075 TPtrC(COMMDB_ID), |
|
1076 bearer ); |
|
1077 User::LeaveIfError( |
|
1078 lanbearer->GotoFirstRecord() ); |
|
1079 // LANMODEM? check commdb_name |
|
1080 HBufC* lbuf; |
|
1081 lbuf = ApCommons::ReadText16ValueLC( lanbearer, |
|
1082 TPtrC(COMMDB_NAME) ); |
|
1083 // if it is KModemBearerLANModem, it is LANModem |
|
1084 if ( *lbuf == KModemBearerLANModem ) |
|
1085 { |
|
1086 retval = EApBearerTypeLANModem; |
|
1087 } |
|
1088 else |
|
1089 { |
|
1090 // LAN? |
|
1091 if ( *lbuf == KModemBearerLANModem ) |
|
1092 { |
|
1093 retval = EApBearerTypeLAN; |
|
1094 } |
|
1095 else |
|
1096 { |
|
1097 // other, but not VPN, or not supported |
|
1098 User::Leave( KErrInvalidBearer ); |
|
1099 } |
|
1100 } |
|
1101 CleanupStack::PopAndDestroy( lbuf ); |
|
1102 CleanupStack::PopAndDestroy( lanbearer ); |
|
1103 CleanupStack::PopAndDestroy( ispt ); |
|
1104 } |
|
1105 else |
|
1106 {// other, but not LAN |
|
1107 User::Leave( KErrInvalidBearer ); |
|
1108 } |
|
1109 #endif // __TEST_LAN_BEARER |
|
1110 } |
|
1111 } |
|
1112 } |
|
1113 } |
|
1114 CleanupStack::PopAndDestroy( 2, iapt );// aIapServiceType, iapt |
|
1115 } |
|
1116 else |
|
1117 { |
|
1118 User::Leave( KErrInvalidBearer ); |
|
1119 } |
|
1120 |
|
1121 CleanupStack::PopAndDestroy( bearert ); // bearert |
|
1122 CleanupStack::Pop( wapBearer ); // wapBearer, |
|
1123 // cannot PopAndDestroy because it has been re-allocated ! |
|
1124 delete wapBearer; |
|
1125 CleanupStack::PopAndDestroy( wapt ); // wapt |
|
1126 |
|
1127 if ( retval == EApBearerTypeAllBearers ) |
|
1128 { |
|
1129 User::Leave( KErrInvalidBearer ); |
|
1130 } |
|
1131 |
|
1132 CLOG( ( EUtil, 1, _L( "<- CApUtils::DoBearerTypeL" ) ) ); |
|
1133 return retval; |
|
1134 } |
313 } |
1135 |
314 |
1136 |
315 |
1137 |
316 |
1138 // --------------------------------------------------------- |
317 // --------------------------------------------------------- |
1139 // CApUtils::DoISPTypeL |
318 // CApUtils::DoISPTypeL |
1140 // --------------------------------------------------------- |
319 // --------------------------------------------------------- |
1141 // |
320 // |
1142 void CApUtils::DoISPTypeL( TUint32 aUid, TCommsDbIspType& aIspType ) |
321 void CApUtils::DoISPTypeL( TUint32 aUid, TCommsDbIspType& aIspType ) |
1143 { |
322 { |
1144 CLOG( ( EUtil, 0, _L( "-> CApUtils::DoISPTypeL" ) ) ); |
|
1145 |
|
1146 TCommsDbIspType retval = EIspTypeInternetAndWAP; |
|
1147 |
|
1148 CCommsDbTableView* wapt; |
|
1149 wapt = iDb->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT), |
|
1150 TPtrC(COMMDB_ID), |
|
1151 aUid ); |
|
1152 |
|
1153 User::LeaveIfError( wapt->GotoFirstRecord() ); |
|
1154 HBufC* wapBearer = ApCommons::ReadText16ValueLC |
|
1155 ( |
|
1156 wapt, |
|
1157 TPtrC(WAP_CURRENT_BEARER) |
|
1158 ); |
|
1159 |
|
1160 if ( *wapBearer == TPtrC(WAP_IP_BEARER) ) |
|
1161 { |
|
1162 CCommsDbTableView* bearert; |
|
1163 bearert = iDb->OpenViewMatchingUintLC( TPtrC(*wapBearer), |
|
1164 TPtrC(WAP_ACCESS_POINT_ID), |
|
1165 aUid ); |
|
1166 |
|
1167 User::LeaveIfError( bearert->GotoFirstRecord() ); |
|
1168 TUint32 aWapIap; |
|
1169 ApCommons::ReadUintL( bearert, TPtrC(WAP_IAP), aWapIap ); |
|
1170 // now we have IAP uid, can go for Service type, ID |
|
1171 |
|
1172 CCommsDbTableView* iapt; |
|
1173 iapt = iDb->OpenViewMatchingUintLC( TPtrC(IAP), |
|
1174 TPtrC(COMMDB_ID), |
|
1175 aWapIap ); |
|
1176 |
|
1177 User::LeaveIfError( iapt->GotoFirstRecord() ); |
|
1178 HBufC* aIapServiceType = ApCommons::ReadText16ValueLC |
|
1179 ( |
|
1180 iapt, |
|
1181 TPtrC(IAP_SERVICE_TYPE) |
|
1182 ); |
|
1183 // decide which bearer, read bearer spec. data. |
|
1184 TUint32 aIsp; |
|
1185 ApCommons::ReadUintL( iapt, TPtrC(IAP_SERVICE), aIsp ); |
|
1186 |
|
1187 // No need to be defensive, if *aIapServiceType is invalid, |
|
1188 // it shall Leave, |
|
1189 // otherwise, we will handle the difference... |
|
1190 CCommsDbTableView* ispt = iDb->OpenViewMatchingUintLC( |
|
1191 *aIapServiceType, |
|
1192 TPtrC(COMMDB_ID), aIsp ); |
|
1193 User::LeaveIfError( ispt->GotoFirstRecord() ); |
|
1194 TUint32 sgd; |
|
1195 if ( ( *aIapServiceType == TPtrC(DIAL_OUT_ISP) ) || |
|
1196 ( *aIapServiceType == TPtrC(DIAL_IN_ISP) ) ) |
|
1197 { // get real IspType |
|
1198 ApCommons::ReadUintL( ispt, TPtrC(ISP_TYPE), sgd ); |
|
1199 } |
|
1200 else |
|
1201 { |
|
1202 // OUTGOING_WCDMA/INCOMING_WCDMA |
|
1203 // read ISP type |
|
1204 ApCommons::ReadUintL( ispt, TPtrC(GPRS_AP_TYPE), sgd ); |
|
1205 } |
|
1206 retval = TCommsDbIspType( sgd ); |
|
1207 CleanupStack::PopAndDestroy( ispt ); // ispt |
|
1208 CleanupStack::Pop( aIapServiceType );// aIapServiceType, |
|
1209 // cannot PopAndDestroy because it has been re-allocated ! |
|
1210 delete aIapServiceType; |
|
1211 CleanupStack::PopAndDestroy( 2, bearert ); // iapt, bearert |
|
1212 } |
|
1213 else |
|
1214 { |
|
1215 User::Leave( KErrInvalidBearer ); |
|
1216 } |
|
1217 |
|
1218 CleanupStack::Pop( wapBearer ); // wapBearer, |
|
1219 // cannot PopAndDestroy because it has been re-allocated ! |
|
1220 delete wapBearer; |
|
1221 CleanupStack::PopAndDestroy( wapt ); // wapt |
|
1222 aIspType = retval; |
|
1223 |
|
1224 CLOG( ( EUtil, 1, _L( "<- CApUtils::DoISPTypeL" ) ) ); |
|
1225 } |
323 } |
1226 |
324 |
1227 |
325 |
1228 // --------------------------------------------------------- |
326 // --------------------------------------------------------- |
1229 // CApUtils::DoNameL |
327 // CApUtils::DoNameL |
1230 // --------------------------------------------------------- |
328 // --------------------------------------------------------- |
1231 // |
329 // |
1232 void CApUtils::DoNameL( TUint32 aUid, TDes& aName ) |
330 void CApUtils::DoNameL( TUint32 aUid, TDes& aName ) |
1233 { |
331 { |
1234 CLOG( ( EUtil, 0, _L( "-> CApUtils::DoNameL" ) ) ); |
|
1235 |
|
1236 CCommsDbTableView* wapt = iDb->OpenViewMatchingUintLC( |
|
1237 TPtrC(WAP_ACCESS_POINT), |
|
1238 TPtrC(COMMDB_ID), aUid ); |
|
1239 User::LeaveIfError( wapt->GotoFirstRecord() ); |
|
1240 HBufC* sgd = ApCommons::ReadText16ValueLC( wapt, TPtrC(COMMDB_NAME) ); |
|
1241 |
|
1242 if ( aName.MaxLength() < sgd->Length() ) |
|
1243 { |
|
1244 User::Leave( KErrDescOverflow ); |
|
1245 } |
|
1246 else |
|
1247 { |
|
1248 aName.SetLength( sgd->Length() ); |
|
1249 aName.Format( KFormat, &*sgd ); |
|
1250 } |
|
1251 CleanupStack::PopAndDestroy( 2, wapt ); // sgd, wapt |
|
1252 |
|
1253 CLOG( ( EUtil, 1, _L( "<- CApUtils::DoNameL" ) ) ); |
|
1254 } |
332 } |
1255 |
333 |
1256 |
334 |
1257 // --------------------------------------------------------- |
335 // --------------------------------------------------------- |
1258 // CApUtils::DoSetNameL |
336 // CApUtils::DoSetNameL |
1259 // --------------------------------------------------------- |
337 // --------------------------------------------------------- |
1260 // |
338 // |
1261 void CApUtils::DoSetNameL( TDes& aName, TUint32 aUid ) |
339 void CApUtils::DoSetNameL( TDes& aName, TUint32 aUid ) |
1262 { |
340 { |
1263 CLOG( ( EUtil, 0, _L( "-> CApUtils::DoSetNameL" ) ) ); |
|
1264 |
|
1265 if ( iExt->iVariant & KApUiEditOnlyVPNs ) |
|
1266 { |
|
1267 User::Leave( KErrNotSupported ); |
|
1268 } |
|
1269 |
|
1270 CCommsDbTableView* wapt; |
|
1271 |
|
1272 wapt = iDb->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT), |
|
1273 TPtrC(COMMDB_ID), aUid ); |
|
1274 User::LeaveIfError( wapt->GotoFirstRecord() ); |
|
1275 HBufC* aCurrent = ApCommons::ReadText16ValueLC( wapt, |
|
1276 TPtrC(COMMDB_NAME) ); |
|
1277 if ( *aCurrent != aName ) |
|
1278 { |
|
1279 TBool aNameChanged( EFalse ); |
|
1280 HBufC* namebuf = aName.AllocL(); |
|
1281 CleanupStack::PushL( namebuf ); |
|
1282 HBufC* sgd = ApCommons::DoMakeValidNameL |
|
1283 ( |
|
1284 *iDb, |
|
1285 aNameChanged, |
|
1286 namebuf, |
|
1287 aUid, |
|
1288 EFalse |
|
1289 ); |
|
1290 if ( aNameChanged ) |
|
1291 { |
|
1292 aName.Copy( *sgd ); |
|
1293 delete sgd; |
|
1294 } |
|
1295 CleanupStack::PopAndDestroy( namebuf ); // namebuf |
|
1296 User::LeaveIfError( wapt->UpdateRecord() ); |
|
1297 wapt->WriteTextL( TPtrC(COMMDB_NAME), aName ); |
|
1298 User::LeaveIfError( wapt->PutRecordChanges() ); |
|
1299 } |
|
1300 CleanupStack::PopAndDestroy( 2, wapt ); // aCurrent,wapt |
|
1301 |
|
1302 CLOG( ( EUtil, 1, _L( "<- CApUtils::DoSetNameL" ) ) ); |
|
1303 } |
341 } |
1304 |
342 |
1305 |
343 |
1306 // --------------------------------------------------------- |
344 // --------------------------------------------------------- |
1307 // CApUtils::DoSetISPTypeL |
345 // CApUtils::DoSetISPTypeL |
1308 // --------------------------------------------------------- |
346 // --------------------------------------------------------- |
1309 // |
347 // |
1310 void CApUtils::DoSetISPTypeL( TUint32 aUid, TCommsDbIspType aIspType ) |
348 void CApUtils::DoSetISPTypeL( TUint32 aUid, TCommsDbIspType aIspType ) |
1311 { |
349 { |
1312 CLOG( ( EUtil, 0, _L( "-> CApUtils::DoSetISPTypeL" ) ) ); |
|
1313 |
|
1314 if ( iExt->iVariant & KApUiEditOnlyVPNs ) |
|
1315 { |
|
1316 User::Leave( KErrNotSupported ); |
|
1317 } |
|
1318 |
|
1319 // first check requested ISP-type validity |
|
1320 if ( ( aIspType == EIspTypeInternetOnly ) || |
|
1321 ( aIspType == EIspTypeWAPOnly ) || |
|
1322 ( aIspType == EIspTypeInternetAndWAP ) ) |
|
1323 { |
|
1324 CCommsDbTableView* wapt; |
|
1325 wapt = iDb->OpenViewMatchingUintLC( TPtrC(WAP_ACCESS_POINT), |
|
1326 TPtrC(COMMDB_ID), aUid ); |
|
1327 User::LeaveIfError( wapt->GotoFirstRecord() ); |
|
1328 HBufC* wapBearer = ApCommons::ReadText16ValueLC |
|
1329 ( |
|
1330 wapt, |
|
1331 TPtrC(WAP_CURRENT_BEARER) |
|
1332 ); |
|
1333 if ( *wapBearer == TPtrC(WAP_IP_BEARER) ) |
|
1334 { |
|
1335 CCommsDbTableView* bearert; |
|
1336 bearert = iDb->OpenViewMatchingUintLC( |
|
1337 *wapBearer, |
|
1338 TPtrC(WAP_ACCESS_POINT_ID), aUid ); |
|
1339 |
|
1340 User::LeaveIfError( bearert->GotoFirstRecord() ); |
|
1341 TUint32 aWapIap; |
|
1342 ApCommons::ReadUintL( bearert, TPtrC(WAP_IAP), aWapIap ); |
|
1343 // now we have IAP uid, can go for Service type, ID |
|
1344 |
|
1345 CCommsDbTableView* iapt; |
|
1346 iapt = iDb->OpenViewMatchingUintLC( TPtrC(IAP), |
|
1347 TPtrC(COMMDB_ID), |
|
1348 aWapIap ); |
|
1349 User::LeaveIfError( iapt->GotoFirstRecord() ); |
|
1350 |
|
1351 HBufC* aIapServiceType = ApCommons::ReadText16ValueLC |
|
1352 ( |
|
1353 iapt, |
|
1354 TPtrC(IAP_SERVICE_TYPE) |
|
1355 ); |
|
1356 |
|
1357 // get ISP ID |
|
1358 TUint32 aIsp; |
|
1359 ApCommons::ReadUintL( iapt, TPtrC(IAP_SERVICE), aIsp ); |
|
1360 |
|
1361 CCommsDbTableView* ispt; |
|
1362 ispt = iDb->OpenViewMatchingUintLC( *aIapServiceType, |
|
1363 TPtrC(COMMDB_ID), aIsp ); |
|
1364 User::LeaveIfError( ispt->GotoFirstRecord() ); |
|
1365 // now we have it, just write: |
|
1366 User::LeaveIfError( ispt->UpdateRecord() ); |
|
1367 // decide which bearer, write into bearer spec. column. |
|
1368 if ( ( *aIapServiceType == TPtrC(DIAL_OUT_ISP) ) || |
|
1369 ( *aIapServiceType == TPtrC(DIAL_IN_ISP) ) ) |
|
1370 { // write real IspType |
|
1371 ispt->WriteUintL( TPtrC(ISP_TYPE), aIspType ); |
|
1372 } |
|
1373 else |
|
1374 { |
|
1375 // OUTGOING_WCDMA / INCOMING_WCDMA |
|
1376 ispt->WriteUintL( TPtrC(GPRS_AP_TYPE), aIspType ); |
|
1377 } |
|
1378 User::LeaveIfError( ispt->PutRecordChanges( EFalse, EFalse ) ); |
|
1379 // ispt, aIapServiceType, iapt, bearert |
|
1380 CleanupStack::PopAndDestroy( 4, bearert ); |
|
1381 } |
|
1382 else |
|
1383 { |
|
1384 User::Leave( KErrInvalidBearer ); |
|
1385 } |
|
1386 CleanupStack::PopAndDestroy( 2, wapt ); // wapBearer, wapt |
|
1387 } |
|
1388 else |
|
1389 { |
|
1390 User::Leave( KErrInvalidIspRequest ); |
|
1391 } |
|
1392 |
|
1393 CLOG( ( EUtil, 1, _L( "<- CApUtils::DoSetISPTypeL" ) ) ); |
|
1394 } |
350 } |
1395 |
351 |
1396 |
352 |
1397 // --------------------------------------------------------- |
353 // --------------------------------------------------------- |
1398 // CApUtils::DoesExistsL |
354 // CApUtils::DoesExistsL |
1399 // --------------------------------------------------------- |
355 // --------------------------------------------------------- |
1400 // |
356 // |
1401 TBool CApUtils::DoesExistsL( TPtrC aTable, TUint32 aUid ) |
357 TBool CApUtils::DoesExistsL( TPtrC aTable, TUint32 aUid ) |
1402 { |
358 { |
1403 CLOG( ( EUtil, 0, _L( "-> CApUtils::DoesExistsL" ) ) ); |
359 return EFalse; |
1404 |
|
1405 TBool retval( EFalse ); |
|
1406 TBool ownTransaction = ApCommons::StartPushedTransactionLC( *iDb, ETrue ); |
|
1407 CCommsDbTableView* table; |
|
1408 table = iDb->OpenViewMatchingUintLC( aTable, |
|
1409 TPtrC(COMMDB_ID), aUid ); |
|
1410 TInt res = table->GotoFirstRecord(); |
|
1411 CleanupStack::PopAndDestroy( table ); // table |
|
1412 if ( res == KErrNone ) |
|
1413 { |
|
1414 retval = ETrue; |
|
1415 } |
|
1416 if ( res != KErrNotFound ) |
|
1417 { |
|
1418 User::LeaveIfError( res ); |
|
1419 } |
|
1420 if ( ownTransaction ) |
|
1421 { |
|
1422 ApCommons::CommitTransaction( *iDb ); |
|
1423 CleanupStack::Pop(); // RollbackTransactionOnLeave |
|
1424 } |
|
1425 |
|
1426 CLOG( ( EUtil, 1, _L( "<- CApUtils::DoesExistsL" ) ) ); |
|
1427 return retval; |
|
1428 } |
360 } |
1429 |
361 |
1430 |
362 |
1431 |
363 |
1432 // --------------------------------------------------------- |
364 // --------------------------------------------------------- |
1433 // CApUtils::DoIsWlanL |
365 // CApUtils::DoIsWlanL |
1434 // --------------------------------------------------------- |
366 // --------------------------------------------------------- |
1435 // |
367 // |
1436 TBool CApUtils::DoIsWlanL( TUint32 aLanCommdbId ) |
368 TBool CApUtils::DoIsWlanL( TUint32 aLanCommdbId ) |
1437 { |
369 { |
1438 CLOG( ( EUtil, 1, _L( "-> CApUtils::DoIsWlanL" ) ) ); |
370 return EFalse; |
1439 |
|
1440 TBool retval( EFalse ); |
|
1441 |
|
1442 CCommsDbTableView* wlantable = NULL; |
|
1443 |
|
1444 // WLAN settings table backlinks to LAN service, |
|
1445 // so we query WLAN settings for a record |
|
1446 // where WLAN_SERVICE_ID is LAN_SERVICE's COMMDB_ID, |
|
1447 // which is aApItem.iIapServiceId... |
|
1448 wlantable = iDb->OpenViewMatchingUintLC( TPtrC(WLAN_SERVICE), |
|
1449 TPtrC(WLAN_SERVICE_ID), |
|
1450 aLanCommdbId ); |
|
1451 |
|
1452 TInt err = wlantable->GotoFirstRecord(); |
|
1453 if ( err == KErrNotFound ) |
|
1454 { |
|
1455 retval = EFalse; |
|
1456 } |
|
1457 else |
|
1458 { |
|
1459 User::LeaveIfError( err ); |
|
1460 retval = ETrue; |
|
1461 } |
|
1462 |
|
1463 CleanupStack::PopAndDestroy( wlantable ); |
|
1464 |
|
1465 CLOG( ( EUtil, 1, _L( "<- CApUtils::DoIsWlanL" ) ) ); |
|
1466 return retval; |
|
1467 } |
371 } |
1468 |
372 |
1469 // End of File |
373 // End of File |