You Are Here:

Community: Wiki

This page was last modified 22:58, 31 October 2008.

TSS000374 - Method User::WaitForRequest() is used with the ETel 3rd Party API (CTelephony)

From Forum Nokia Wiki



ID TSS000374 Creation date July 7, 2006
Platform S60 3rd Edition Devices
Category Symbian C++ Subcategory


Keywords (APIs, classes, methods, functions):

Overview

Method User::WaitForRequest() is used with the ETel 3rd Party API (CTelephony)

Description

The ETel 3rd Party API (that is, CTelephony) was designed to be used in asynchronous mode, with its methods called from an active object that is then going to wait for the method to complete. As an active object can have, by definition, only one active request at a time, the asynchronous methods of Telephony are designed to panic (with "Telephony 0") whenever it is detected during a method call that the TRequestStatus parameter passed to this method (in fact, the iStatus member of CActive) is already set to KRequestPending.
A common (although not recommended) practice among Symbian developers is to "synchronize" the asynchronous method calls with the User::WaitForRequest to block the thread until the operation completes.
There are two major problems with this approach:
- The asynchronous call can take a long time until it completes and keeping the thread blocked for the entire time can cause a VIEWSERV 11 panic (see Symbian’s FAQ-0920).
 - The asynchronous method may be implemented using other active objects and asynchronous methods running on the same thread. If so, the methods can never complete since the thread is blocked and as such, the thread will remain blocked forever.
In a concrete case of CTelephony and considering the following code example:
CTelephony::TBatteryInfoV1 batterystrength;
CTelephony::TBatteryInfoV1Pckg battery(batterystrength);
CTelephony* tel = CTelephony::NewLC();
TRequestStatus status = KRequestPending; // (1)
tel->GetBatteryInfo(status, battery);
User::WaitForRequest(myStat); // (2)
...
CleanupStack::PopAndDestroy();
This means:
- The TRequestStatus variable is initialized with KRequestPending - line  (1)  - a very common mistake that usually does not affect the API calls except that with CTelephony it will cause the "Telephony 0" panic as described above. Please note that a TRequestStatus variable should, in general, not be initialized.
- Assuming that the initialization from (1) is removed, the code will never return from line (2) as CTelephony’s asynchronous methods cannot complete while the thread is blocked.
In conclusion, CTelephony must always be used asynchronously, from within an active object. Moreover, User::WaitForRequest must be used with caution.

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditFurlTechnocratiMagnoliaTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZdescriptionQSxEa0E20WikiE20javaE20symbianE5fosE20s60E20maemoE20cE2bE2bE20WikiE20HomeE20WikiE20HelpE20OverviewE20GlossaryE20CreateE20PageE20ProposeE20anE20ArticleE20SpotlightE20TopicE20E2dE20WE52TE20WidgetsE20ProgrammingE20E4canguageE20E2dE20SymbianE20CE2bE2bE20E2dE20OpenE20CE2fCE2bE2bE20E2dE20JavaE20E2dE20FlashE20E4citeE20E2dE20PythonE20WebE20TechnologiesE20E2dE20WE52TE20WidgetsE20E2dE20WidSetsE20ToolsE20andE20SE44KE20CodeE20E45E78amplesE20KnowledgeE20BaseE20TechnologyE20AreasE20SoftwareE20PlatformsE20E44evelopmentE20ProcessE20E3fE3fWikiE20ChineseE20E3fE3fE3fWikiE20JapaneseE20PortugueseE2fBrazilianE20E52ussianE20WhatE20linksE20hereE20UploadE20fileE20SpecialE20pagesE20PrintableE20versionE44ownloadE20asE20PE44FE20GoE20ToE20E2eE2eE2eX qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fTSS000416E5fE2dE5fFilteringE5fstandardE5fS60E5fshortcutE5fkeyE5fbehaviorX qdcZpublisherQUxhttpE3aE2fE2fswE2enokiaE2ecomE2fidE2fc764fd1cE2d8b06E2d499aE2d9a6aE2d17c3903d5a65E2fforumE5fnokiaE5fcrawlerE5fagentX qdcZtitleQSxTSS000416E20E2dE20FilteringE20standardE20S60E20shortcutE20keyE20behaviorE20E2dE20ForumE20NokiaE20WikiX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfnTypeZCommunityContentQ qdcZtypeQUqfnTypeZKnowledgeBaseContentQ qdcZtypeQUqfnTypeZE52esourceQ qdcZtypeQUqfnTypeZTechnicalSolutionQ qdcZtypeQUqfnTypeZWebpageQ qdcZtypeQUqfnTypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qrssZdescriptionQSxEa0E20WikiE20javaE20symbianE5fosE20s60E20maemoE20cE2bE2bE20WikiE20HomeE20WikiE20HelpE20OverviewE20GlossaryE20CreateE20PageE20ProposeE20anE20ArticleE20SpotlightE20TopicE20E2dE20WE52TE20WidgetsE20ProgrammingE20E4canguageE20E2dE20SymbianE20CE2bE2bE20E2dE20OpenE20CE2fCE2bE2bE20E2dE20JavaE20E2dE20FlashE20E4citeE20E2dE20PythonE20WebE20TechnologiesE20E2dE20WE52TE20WidgetsE20E2dE20WidSetsE20ToolsE20andE20SE44KE20CodeE20E45E78amplesE20KnowledgeE20BaseE20TechnologyE20AreasE20SoftwareE20PlatformsE20E44evelopmentE20ProcessE20E3fE3fWikiE20ChineseE20E3fE3fE3fWikiE20JapaneseE20PortugueseE2fBrazilianE20E52ussianE20WhatE20linksE20hereE20UploadE20fileE20SpecialE20pagesE20PrintableE20versionE44ownloadE20asE20PE44FE20GoE20ToE20E2eE2eE2eX qfnZdistributionQUxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2fX qfnZtypeQUqfnTypeZCommunityContentQ qfnZtypeQUqfnTypeZKnowledgeBaseContentQ qfnZtypeQUqfnTypeZE52esourceQ qfnZtypeQUqfnTypeZTechnicalSolutionQ qfnZtypeQUqfnTypeZWebpageQ qfnZtypeQUqfnTypeZWikiContentQ qfnZupdatedQDx2008E2d10E2d02X qmarsZdescriptionQSxEa0E20WikiE20javaE20symbianE5fosE20s60E20maemoE20cE2bE2bE20WikiE20HomeE20WikiE20HelpE20OverviewE20GlossaryE20CreateE20PageE20ProposeE20anE20ArticleE20SpotlightE20TopicE20E2dE20WE52TE20WidgetsE20ProgrammingE20E4canguageE20E2dE20SymbianE20CE2bE2bE20E2dE20OpenE20CE2fCE2bE2bE20E2dE20JavaE20E2dE20FlashE20E4citeE20E2dE20PythonE20WebE20TechnologiesE20E2dE20WE52TE20WidgetsE20E2dE20WidSetsE20ToolsE20andE20SE44KE20CodeE20E45E78amplesE20KnowledgeE20BaseE20TechnologyE20AreasE20SoftwareE20PlatformsE20E44evelopmentE20ProcessE20E3fE3fWikiE20ChineseE20E3fE3fE3fWikiE20JapaneseE20PortugueseE2fBrazilianE20E52ussianE20WhatE20linksE20hereE20UploadE20fileE20SpecialE20pagesE20PrintableE20versionE44ownloadE20asE20PE44FE20GoE20ToE20E2eE2eE2eX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfnTypeZCommunityContentQ qrdfZtypeQUqfnTypeZKnowledgeBaseContentQ qrdfZtypeQUqfnTypeZE52esourceQ qrdfZtypeQUqfnTypeZTechnicalSolutionQ qrdfZtypeQUqfnTypeZWebpageQ qrdfZtypeQUqfnTypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ