×
Namespaces

Variants
Actions
(Difference between revisions)

Available positioning modules

From Nokia Developer Wiki
Jump to: navigation, search
FireSwarog (Talk | contribs)
hamishwillee (Talk | contribs)
m (Hamishwillee - Tidy wiki text)
 
(3 intermediate revisions by one user not shown)
Line 1: Line 1:
{{ReviewerApproved}}
+
[[Category:Location]][[Category:Symbian C++]][[Category:How To]][[Category:Code Snippet]]
[[Category:Symbian C++]]
+
{{Abstract|The following code snippet demonstrates how to obtain list of the available positioning modules using Symbian C++.}}
[[Category:Location Based Services]]
+
 
[[Category:How To]]
+
{{ArticleMetaData <!-- v1.1 -->
[[Category:Code Examples]]
+
|sourcecode= <!-- Link to example source code e.g. [[Media:The Code Example ZIP.zip]] -->
The following code snippet demonstrates how to obtain list of the available positioning modules.
+
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 +
|devices= <!-- Devices tested against - e.g. ''devices=Nokia 6131 NFC, Nokia C7-00'') -->
 +
|sdk= <!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Qt SDK 1.1.4]) -->
 +
|platform= <!-- Compatible platforms - e.g. Symbian^1 and later, Qt 4.6 and later -->
 +
|devicecompatability= <!-- Compatible devices e.g.: All* (must have internal GPS) -->
 +
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 +
|signing= <!-- Signing requirements - empty or one of: Self-Signed, DevCert, Manufacturer -->
 +
|capabilities= <!-- Capabilities required by the article/code example (e.g. Location, NetworkServices. -->
 +
|keywords= <!-- APIs, classes and methods (e.g. QSystemScreenSaver, QList, CBase -->
 +
|id= <!-- Article Id (Knowledge base articles only) -->
 +
|language= <!-- Language category code for non-English topics - e.g. Lang-Chinese -->
 +
|translated-by= <!-- [[User:XXXX]] -->
 +
|translated-from-title= <!-- Title only -->
 +
|translated-from-id= <!-- Id of translated revision -->
 +
|review-by= <!-- After re-review: [[User:username]] -->
 +
|review-timestamp= <!-- After re-review: YYYYMMDD -->
 +
|update-by= <!-- After significant update: [[User:username]]-->
 +
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 +
|creationdate= 20080420
 +
|author= [[User:Den123]]
 +
}}
  
 
'''Headers:'''
 
'''Headers:'''
Line 114: Line 134:
 
}
 
}
 
</code>
 
</code>
 +
 +
 +
<!-- Translation --> [[ru:Доступные модули определения местоположения]]

Latest revision as of 09:03, 7 February 2012

The following code snippet demonstrates how to obtain list of the available positioning modules using Symbian C++.

Article Metadata
Article
Created: Den123 (20 Apr 2008)
Last edited: hamishwillee (07 Feb 2012)

Headers:

#include <lbs.h>

Libraries:

LIBRARY       lbs.lib 
LIBRARY 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:

#include <aknlists.h>

Libraries:

LIBRARY       avkon.lib
LIBRARY eikcoctl.lib
LIBRARY 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();
}
This page was last modified on 7 February 2012, at 09:03.
52 page views in the last 30 days.