This page was last modified 10:08, 20 April 2008.
Available positioning modules
From Forum Nokia Wiki
The following code snippet demonstrates how to obtain list of the available positioning modules.
Headers:
- lbs.h
Libraries:
- lbs.lib
- bafl.lib - for CDesCArrayFlat
// Position server RPositionServer posServer; User :: LeaveIfError( posServer.Connect() ); CleanupClosePushL( posServer ); // get default module UID TPositionModuleId defModuleUid; User :: LeaveIfError( posServer.GetDefaultModuleId( defModuleUid ) ); // get count of available modules TUint numOfModules = 0; User :: LeaveIfError( posServer.GetNumModules( numOfModules ) ); if( numOfModules ) { // array for storing CDesCArrayFlat* itemArray = new ( ELeave ) CDesCArrayFlat( numOfModules ); CleanupStack :: PushL( itemArray ); _LIT( KDefault, "* " ); // default module mark _LIT( KGeneral, "- " ); // general module mark const TInt KMaxModuleNameLen = 128; for( TUint i = 0; i < numOfModules; i++ ) { // read current module info TPositionModuleInfo moduleinfo; posServer.GetModuleInfoByIndex ( i, moduleinfo ); // read current module name TBuf< KMaxModuleNameLen > moduleName; moduleinfo.GetModuleName( moduleName ); // insert marker "*" or "-" moduleName.Insert( 0, moduleinfo.ModuleId() == defModuleUid ? KDefault : KGeneral ); // append to array itemArray->AppendL( moduleName ); } ShowListL( itemArray ); CleanupStack :: PopAndDestroy(); // itemArray } CleanupStack :: PopAndDestroy(); // posServer
ShowListL function can be implemented as follows:
Headers:
- aknlists.h
Libraries:
- avkon.lib
- eikcoctl.lib
- eikctl.lib
void YourClass :: ShowListL( CDesCArray* anArray ) { // create CEikTextListBox instance, list CEikTextListBox* list = new( ELeave ) CAknSinglePopupMenuStyleListBox; // push list'pointer to CleanupStack. CleanupStack::PushL( list ); // create CAknPopupList instance, popupList CAknPopupList* popupList = CAknPopupList::NewL( list, R_AVKON_SOFTKEYS_OK_EMPTY, AknPopupLayouts::EMenuWindow ); // push popupList'pointer to CleanupStack. CleanupStack::PushL( popupList ); // initialize listbox. list->ConstructL( popupList, CEikListBox::ELeftDownInViewRect ); list->CreateScrollBarFrameL( ETrue ); list->ScrollBarFrame()->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EAuto ); // set listitems. CTextListBoxModel* model = list->Model(); model->SetItemTextArray( anArray ); model->SetOwnershipType( ELbmDoesNotOwnItemArray ); // show popup list and then show return value. popupList->ExecuteLD(); // pop the popupList's pointer from CleanupStack CleanupStack::Pop(); // pop and Destroy the list's pointer from CleanupStack CleanupStack::PopAndDestroy(); }
| Related Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 7610 video positioning | __randomm | Mobile Java Media (Graphics & Sounds) | 2 | 2005-10-20 02:34 |
| Building pys60 on linux? | sjh | Python | 2 | 2006-11-06 16:03 |
| [announce] LocationRequestor module (location API) ! | cyke64 | Python | 60 | 2008-06-30 11:49 |
| Script-level modules not allowed in 3rd Ed? | kevin_s2f | Python | 6 | 2007-07-05 18:46 |
| D211 and phoebe3 (RedHat 8.1beta 8.0.94) | jarmo2 | Multimodecards | 1 | 2003-04-07 19:25 |
