Example Application Guide

 

CGeoProfile Class Reference

#include <geoprofile.h>

Inheritance diagram for CGeoProfile:

List of all members.

Detailed Description

Geo Profile Exchange Structure

Definition at line 32 of file geoprofile.h.

Public Types

enum  TGeoPlaceType { EUndefined, ECoordinate, ENetworkCell }
enum  TGeoTriggerType { EEntryTrigger, EExitTrigger }

Public Member Functions

virtual ~CGeoProfile ()
TPtrC GeoPlaceName ()
TPtrC ProfileName ()
TInt GeoProfileId ()
void SetGeoProfileIdL (TInt aGeoProfileId)
TInt GeoPositionType ()
TLocality & GeoPositionInfo ()
void SetGeoPositionInfoL (const TDesC &aGeoPlaceName, TLocality &aPositionInfo)
TInt GeoProfileRadius ()
void SetGeoProfileRadius (TInt aRadius)
TInt TriggerId ()
void SetTriggerId (TInt aTriggerId)
TInt TriggerType ()
void SetTriggerType (TInt aTriggerType)
void PartialInternalizeL (const TDesC &aInputBuffer)
HBufC * PartialExternalizeLC ()

Static Public Member Functions

static CGeoProfileNewL ()
static CGeoProfileNewL (const TDesC &aGeoPlaceName, TLocality &aPositionInfo, TInt aGeoProfileId=0, TInt aProfileRadius=100, TInt aTriggerId=-1, TInt aTriggerType=EEntryTrigger)

Private Member Functions

 CGeoProfile ()
void ConstructL (const TDesC &aGeoPlaceName, TInt aGeoProfileId, TLocality &aPositionInfo, TInt aProfileRadius, TInt aTriggerId, TInt aTriggerType)
void SetProfileNameL (const TDesC &aProfileName)
void SetGeoPositionType (TInt aPositionType)
void SetGeoPlaceNameL (const TDesC &aGeoPlaceName)

Private Attributes

HBufC * iGeoPlaceName
HBufC * iProfileName
TInt iGeoProfileId
TLocality iPositionInfo
TInt iPositionType
TInt iProfileRadius
TInt iTriggerId
TInt iTriggerType


Constructor & Destructor Documentation

CGeoProfile::~CGeoProfile  )  [virtual]
 

C++ Destructor. Frees all the resources

Definition at line 54 of file geoprofile.cpp.

References iGeoPlaceName, and iProfileName.

00055     {
00056     GEOPROFILEDEBUG("+ CGeoProfile::~CGeoProfile" )
00057     
00058     // Delete the member variables
00059     delete iGeoPlaceName;
00060     
00061     delete iProfileName;  
00062     
00063     GEOPROFILEDEBUG("- CGeoProfile::~CGeoProfile" )
00064     }   

CGeoProfile::CGeoProfile  )  [private]
 

C++ Constructor

Definition at line 42 of file geoprofile.cpp.

Referenced by NewL().

00043     :iPositionType( EUndefined ),
00044     iProfileRadius( KMinGeoProfileRadius ),
00045     iTriggerId( 0xFFFFFFF ),
00046     iTriggerType( EEntryTrigger )    
00047     {    
00048     }


Member Function Documentation

CGeoProfile * CGeoProfile::NewL  )  [static]
 

Constructs a new instance of CGeoProfile Entry

Definition at line 70 of file geoprofile.cpp.

Referenced by CGeoProfileEditor::ConstructL(), CGeoProfilesView::HandleCommandL(), and CGeoProfilesEngine::ListProfilesL().

00071     {
00072     TLocality locality;    
00073     return NewL( KNullDesC(), locality, KErrNotFound, EUndefined );                                                                  
00074     }

CGeoProfile * CGeoProfile::NewL const TDesC &  aGeoPlaceName,
TLocality &  aPositionInfo,
TInt  aGeoProfileId = 0,
TInt  aProfileRadius = 100,
TInt  aTriggerId = -1,
TInt  aTriggerType = EEntryTrigger
[static]
 

Constructs a new instance of CGeoProfile Entry.

Definition at line 80 of file geoprofile.cpp.

References CGeoProfile().

00086     {
00087     GEOPROFILEDEBUG("+ CGeoProfile::NewL" ) 
00088     
00089     CGeoProfile* self = new ( ELeave ) CGeoProfile();
00090     CleanupStack::PushL( self );
00091     self->ConstructL( aGeoPlaceName, 
00092                       aGeoProfileId, 
00093                       aPositionInfo, 
00094                       aProfileRadius, 
00095                       aTriggerId, 
00096                       aTriggerType );
00097     CleanupStack::Pop( self );
00098     
00099     GEOPROFILEDEBUG("- CGeoProfile::NewL" ) 
00100     return self;                                                                  
00101     }

TPtrC CGeoProfile::GeoPlaceName  ) 
 

Accessor method for obtaining the Geo-Profile Name

Definition at line 146 of file geoprofile.cpp.

References iGeoPlaceName.

Referenced by CGeoProfileEditor::ConstructL(), CGeoProfileEditor::LoadPlaceL(), and CGeoProfileEditor::OkToExitL().

00147     {
00148     return iGeoPlaceName->Des();
00149     }

TPtrC CGeoProfile::ProfileName  ) 
 

Accessor method for obtaining the Profile Name

Definition at line 155 of file geoprofile.cpp.

References iProfileName.

Referenced by CGeoProfileEditor::LoadProfileL().

00156     {
00157     return iProfileName->Des();
00158     }

TInt CGeoProfile::GeoProfileId  ) 
 

Accessor method for obtaining the Item Id

Definition at line 179 of file geoprofile.cpp.

References iGeoProfileId.

Referenced by CGeoProfileEditor::ConstructL(), and CGeoProfileEditor::OkToExitL().

00180     {
00181     return iGeoProfileId;
00182     }

void CGeoProfile::SetGeoProfileIdL TInt  aGeoProfileId  ) 
 

Accessor method for setting the Profile Name

Definition at line 188 of file geoprofile.cpp.

References iGeoProfileId, and SetProfileNameL().

Referenced by ConstructL(), CGeoProfileEditor::HandleProfileSelectionL(), CGeoProfileEditor::OkToExitL(), and PartialInternalizeL().

00189     {
00190     GEOPROFILEDEBUG("+ CGeoProfile::SetGeoProfileIdL" ) 
00191     
00192     // Obtain the list of profiles
00193     MProEngEngine* profileEng = ProEngFactory::NewEngineL();
00194     CleanupReleasePushL( *profileEng );
00195 
00196     MProEngProfileNameArray* profileNames = profileEng->ProfileNameArrayLC();
00197     TInt index = 0;
00198     index = profileNames->FindById( aGeoProfileId );
00199     if ( KErrNotFound == index )
00200         {
00201         // Setting the Default Value of index back to 0
00202         iGeoProfileId = profileEng->ActiveProfileId();
00203         index = profileNames->FindById( iGeoProfileId );
00204         }
00205     else
00206         {
00207         iGeoProfileId = profileNames->ProfileId( index );      
00208         }      
00209     SetProfileNameL( profileNames->MdcaPoint( index ));
00210     CleanupStack::PopAndDestroy( 2 );
00211     
00212     GEOPROFILEDEBUG("- CGeoProfile::SetGeoProfileIdL" ) 
00213     }

TInt CGeoProfile::GeoPositionType  ) 
 

Location Information Type

Definition at line 219 of file geoprofile.cpp.

References iPositionType.

Referenced by CGeoProfilesEngine::AddProfileL(), CGeoProfileEditor::CheckIfSavableL(), and CGeoProfilesEngine::DoUpdateProfileL().

00220     {
00221     return iPositionType;
00222     }

TLocality & CGeoProfile::GeoPositionInfo  ) 
 

Location Information

Definition at line 237 of file geoprofile.cpp.

References iPositionInfo.

Referenced by CGeoProfileEditor::ConstructL(), and CGeoProfileEditor::OkToExitL().

00238     {
00239     return iPositionInfo;
00240     }

void CGeoProfile::SetGeoPositionInfoL const TDesC &  aGeoPlaceName,
TLocality &  aPositionInfo
 

Accessor method for setting Location Information

Definition at line 246 of file geoprofile.cpp.

References iPositionInfo, SetGeoPlaceNameL(), and SetGeoPositionType().

Referenced by ConstructL(), CGeoProfileEditor::HandlePlaceSelectionL(), and CGeoProfileEditor::OkToExitL().

00248     {    
00249     if ( !Math::IsNaN( aPositionInfo.Latitude()) && 
00250          !Math::IsNaN( aPositionInfo.Longitude()))
00251         {
00252         SetGeoPositionType( ECoordinate );
00253         iPositionInfo = aPositionInfo;
00254         SetGeoPlaceNameL( aGeoPlaceName );      
00255         }    
00256     }

TInt CGeoProfile::GeoProfileRadius  ) 
 

Accessor method for obtaining the radius

Definition at line 262 of file geoprofile.cpp.

References iProfileRadius.

Referenced by CGeoProfileEditor::ConstructL(), CGeoProfileEditor::LoadPlaceL(), and CGeoProfileEditor::OkToExitL().

00263     {
00264     return iProfileRadius;
00265     }

void CGeoProfile::SetGeoProfileRadius TInt  aRadius  ) 
 

Accessor method for setting the radius

Definition at line 289 of file geoprofile.cpp.

References iProfileRadius.

Referenced by ConstructL(), CGeoProfileEditor::HandleControlStateChangeL(), and CGeoProfileEditor::OkToExitL().

00290     {
00291     if ( aRadius < KMinGeoProfileRadius )
00292         {
00293         iProfileRadius = KMinGeoProfileRadius; 
00294         }
00295     else
00296         {
00297         iProfileRadius = aRadius;  
00298         }
00299     }

TInt CGeoProfile::TriggerId  ) 
 

Accessor method for obtaining the Trigger Id

Definition at line 280 of file geoprofile.cpp.

References iTriggerId.

Referenced by CGeoProfileEditor::ConstructL(), and CGeoProfilesEngine::RemoveProfileL().

00281     {
00282     return iTriggerId;
00283     }

void CGeoProfile::SetTriggerId TInt  aTriggerId  ) 
 

Accessor method for setting the Trigger Id

Definition at line 271 of file geoprofile.cpp.

References iTriggerId.

00272     {
00273     iTriggerId = aTriggerId;
00274     }

TInt CGeoProfile::TriggerType  ) 
 

Accessor method for obtaining the Trigger Type

Definition at line 305 of file geoprofile.cpp.

References iTriggerType.

Referenced by CGeoProfileEditor::ConstructL(), CGeoProfileEditor::LoadTriggerTypeL(), and CGeoProfileEditor::OkToExitL().

00306     {
00307     return iTriggerType;    
00308     }

void CGeoProfile::SetTriggerType TInt  aTriggerType  ) 
 

Accessor method for setting the Trigger Type

Definition at line 314 of file geoprofile.cpp.

References iTriggerType.

Referenced by ConstructL(), CGeoProfileEditor::HandleControlStateChangeL(), and CGeoProfileEditor::OkToExitL().

00315     {
00316     iTriggerType = aTriggerType;
00317     }

void CGeoProfile::PartialInternalizeL const TDesC &  aInputBuffer  ) 
 

Internalized the information available from the buffer The buffer must be in following format 1. Profile ID ( Integer ) 2. Location Type ( Integer ) 3. Horizontal Accuracy ( Integer ) 4. Radius ( Integer )

Definition at line 348 of file geoprofile.cpp.

References iPositionInfo, SetGeoPositionType(), and SetGeoProfileIdL().

00349     {
00350     GEOPROFILEDEBUG("+ CGeoProfile::PartialInternalizeL" ) 
00351     
00352     TInt32 value = 0;
00353     TLex lexer( aInputBuffer );
00354     
00355     // Read Profile Id   
00356     User::LeaveIfError( lexer.Val( value ));
00357     SetGeoProfileIdL( value );
00358     lexer.Inc();
00359     
00360     // Read the Position Type Info
00361     User::LeaveIfError( lexer.Val( value ));
00362     SetGeoPositionType( value );
00363     lexer.Inc();    
00364     
00365     // Write the Horizontal Accuracy
00366     User::LeaveIfError( lexer.Val( value ));
00367     if ( value == -1 )
00368         {
00369         TRealX nan;
00370         nan.SetNaN();
00371         iPositionInfo.SetHorizontalAccuracy( nan );        
00372         }
00373     else
00374         {
00375         iPositionInfo.SetHorizontalAccuracy( value );      
00376         }
00377     lexer.Inc();        
00378         
00379     // Set the profile radius
00380     User::LeaveIfError( lexer.Val( value ));
00381     SetGeoProfileRadius( value );
00382     lexer.Inc();
00383     
00384     GEOPROFILEDEBUG("- CGeoProfile::PartialInternalizeL" )     
00385     }

HBufC * CGeoProfile::PartialExternalizeLC  ) 
 

Partially externalizes the contents of the Geo Profile to a buffer The following fields are externalized and in the following format 1. Profile ID ( Integer ) 2. Location Type ( Integer ) 3. Horizontal Accuracy ( Integer ) 4. Radius ( Integer )

Definition at line 391 of file geoprofile.cpp.

References iGeoProfileId, iPositionInfo, iPositionType, and iProfileRadius.

00392     {
00393     GEOPROFILEDEBUG("+ CGeoProfile::PartialExternalizeLC" ) 
00394     
00395     HBufC* buffer = HBufC::NewLC( 256 );
00396     TPtr bufferPtr = buffer->Des();
00397 
00398     // Write Geo Profile Id
00399     bufferPtr.AppendNum( iGeoProfileId );
00400     bufferPtr.Append( KDeliminator );
00401     
00402     // Write Position Type
00403     bufferPtr.AppendNum( iPositionType );
00404     bufferPtr.Append( KDeliminator );
00405         
00406     // Write the Horizontal Accuracy
00407     if ( Math::IsNaN( iPositionInfo.HorizontalAccuracy()))
00408         {
00409         bufferPtr.AppendNum( -1 );    
00410         }
00411     else
00412         {
00413        bufferPtr.AppendNum( iPositionInfo.HorizontalAccuracy());
00414         }
00415     bufferPtr.Append( KDeliminator );
00416         
00417     // Write the Radius
00418     bufferPtr.AppendNum( iProfileRadius ); 
00419     bufferPtr.Append( KDeliminator );
00420     
00421     GEOPROFILEDEBUG("- CGeoProfile::PartialExternalizeLC" ) 
00422     
00423     return buffer;
00424     }

void CGeoProfile::ConstructL const TDesC &  aGeoPlaceName,
TInt  aGeoProfileId,
TLocality &  aPositionInfo,
TInt  aProfileRadius,
TInt  aTriggerId,
TInt  aTriggerType
[private]
 

Second phase of two phase construction

Definition at line 107 of file geoprofile.cpp.

References iGeoPlaceName, iProfileName, iTriggerId, SetGeoPlaceNameL(), SetGeoPositionInfoL(), SetGeoProfileIdL(), SetGeoProfileRadius(), and SetTriggerType().

00113     {
00114     GEOPROFILEDEBUG("+ CGeoProfile::ConstructL" ) 
00115     
00116     // Create all member variables
00117     iGeoPlaceName = HBufC::NewL( KGeoPlaceNameMaxLength );    
00118     
00119     iProfileName = HBufC::NewL( KGeoProfileNameMaxLength );
00120     iProfileName->Des().Zero();
00121     
00122     SetGeoPlaceNameL( KNullDesC());
00123         
00124     // Copy the Item Id
00125     SetGeoProfileIdL( aGeoProfileId );
00126     
00127     // Copy the Location information contents
00128     SetGeoPositionInfoL( aGeoPlaceName, aPositionInfo );
00129     
00130     // Set the profile Radius
00131     SetGeoProfileRadius( aProfileRadius );
00132     
00133     // Set the Trigger id
00134     iTriggerId = aTriggerId; 
00135     
00136     // Set Trigger Type
00137     SetTriggerType( aTriggerType );
00138     
00139     GEOPROFILEDEBUG("- CGeoProfile::ConstructL" )    
00140     }

void CGeoProfile::SetProfileNameL const TDesC &  aProfileName  )  [private]
 

Accessor method for setting the Profile Name

Definition at line 164 of file geoprofile.cpp.

Referenced by SetGeoProfileIdL().

00165     {
00166     if ( aProfileName.Length() > KGeoProfileNameMaxLength )
00167         {
00168         User::Leave( KErrOverflow );
00169         }
00170         
00171     // Copy the corresponding profile name
00172     iProfileName->Des().Copy( aProfileName );    
00173     }

void CGeoProfile::SetGeoPositionType TInt  aPositionType  )  [private]
 

Accessor method for setting Location Information

Definition at line 228 of file geoprofile.cpp.

References iPositionType.

Referenced by PartialInternalizeL(), and SetGeoPositionInfoL().

00229     {
00230     iPositionType = aPositionType;
00231     }

void CGeoProfile::SetGeoPlaceNameL const TDesC &  aGeoPlaceName  )  [private]
 

Accessor method for setting Location name

Definition at line 323 of file geoprofile.cpp.

Referenced by ConstructL(), and SetGeoPositionInfoL().

00324     {    
00325     if ( aGeoPlaceName.Length() > KGeoPlaceNameMaxLength )
00326         {
00327         User::Leave( KErrOverflow );
00328         }
00329     
00330     if ( !aGeoPlaceName.Length())
00331         {
00332         HBufC* placeName = StringLoader::LoadLC( R_LBL_GEOPROFILES_DEFINE );    
00333         iGeoPlaceName->Des().Copy( placeName->Des());    
00334         CleanupStack::PopAndDestroy( placeName );
00335         SetGeoPositionType( EUndefined );       
00336         }
00337     else
00338         {
00339         // Copy the corresponding profile name
00340         iGeoPlaceName->Des().Copy( aGeoPlaceName );             
00341         }  
00342     }


Member Data Documentation

HBufC* CGeoProfile::iGeoPlaceName [private]
 

Geo Profile Name Owns

Definition at line 196 of file geoprofile.h.

Referenced by ConstructL(), GeoPlaceName(), and ~CGeoProfile().

HBufC* CGeoProfile::iProfileName [private]
 

Profile Name Owns

Definition at line 202 of file geoprofile.h.

Referenced by ConstructL(), ProfileName(), and ~CGeoProfile().

TInt CGeoProfile::iGeoProfileId [private]
 

Geo Profile Identifier

Definition at line 207 of file geoprofile.h.

Referenced by GeoProfileId(), PartialExternalizeLC(), and SetGeoProfileIdL().

TLocality CGeoProfile::iPositionInfo [private]
 

Geo Profile Location

Definition at line 212 of file geoprofile.h.

Referenced by GeoPositionInfo(), PartialExternalizeLC(), PartialInternalizeL(), and SetGeoPositionInfoL().

TInt CGeoProfile::iPositionType [private]
 

Position Type

Definition at line 217 of file geoprofile.h.

Referenced by GeoPositionType(), PartialExternalizeLC(), and SetGeoPositionType().

TInt CGeoProfile::iProfileRadius [private]
 

Radius of the profile

Definition at line 222 of file geoprofile.h.

Referenced by GeoProfileRadius(), PartialExternalizeLC(), and SetGeoProfileRadius().

TInt CGeoProfile::iTriggerId [private]
 

Trigger Id

Definition at line 227 of file geoprofile.h.

Referenced by ConstructL(), SetTriggerId(), and TriggerId().

TInt CGeoProfile::iTriggerType [private]
 

Trigger Type

Definition at line 232 of file geoprofile.h.

Referenced by SetTriggerType(), and TriggerType().


The documentation for this class was generated from the following files:

© Nokia 2009

Back to top