i followed the below example link
http://www.developer.nokia.com/Commu...ymbian_C%2B%2B to retrieve the latitude & longitude of the cell.
as per the example i implemented the MPositionObserver ABCclass to CUnregisterview class. The functions
virtual void PositionUpdatedL(TPositionInfoBase& aPosInfo) = 0;
virtual TInt ErrorL(TInt aError) = 0;
was overridden in CUnregisterview class as : -
void CUnRegisterView ::PositionUpdatedL(TPositionInfoBase& aPosInfo)
{
if (aPosInfo.PositionClassType() & EPositionInfoClass)
{
// Cast the TPositionInfoBase object to TPositionInfo
TPositionInfo* posInfo = static_cast<TPositionInfo*>(&aPosInfo);
// Get position
TPosition position;
posInfo->GetPosition(position);
// Convert positions to the descriptors
TBuf<KDegreeLength> latitudeDegr;
GetDegreesString(position.Latitude(), latitudeDegr);
// Convert positions to the descriptors
TBuf<KDegreeLength> longitudeDegr;
GetDegreesString(position.Longitude(), longitudeDegr);
}
}
GetDegreesString was defined as:----
void CUnRegisterView::GetDegreesString(
const TReal64& aDegrees,TBuf<KDegreeLength>& aDegreesString) const
{
const TReal KSecondsInMinute = 60.0;
const TInt KNumWidth = 3;
// If the aDegree is a proper number
if ( !Math::IsNaN(aDegrees) )
{
// Integer part of the degrees
TInt intDegrees = static_cast<TInt>(aDegrees);
// Positive float of the degrees
TReal64 realDegrees = aDegrees;
// Convert to positive values
if ( intDegrees < 0 )
{
intDegrees = -intDegrees;
realDegrees = -realDegrees;
}
// Minutes
TReal64 realMinutes = (realDegrees - intDegrees) * KSecondsInMinute;
// Integer part of the minutes
TInt intMinutes = static_cast<TInt>(realMinutes);
// Seconds
TReal64 realSeconds = (realMinutes - intMinutes) * KSecondsInMinute;
TInt intSeconds = static_cast<TInt>((realMinutes - intMinutes) * KSecondsInMinute);
// Check the sign of the result
if ( aDegrees >= 0 )
{
aDegreesString.Append(KDelimPlus);
}
else
{
aDegreesString.Append(KDelimMinus);
}
// Add the degrees
TInt64 value = intDegrees;
aDegreesString.AppendNum(value);
// Add the separator
aDegreesString.Append(KDelimDegree);
// Add the minutes
value = intMinutes;
aDegreesString.AppendNum(value);
// Add the separator
aDegreesString.Append(KApostrophe);
// Add the seconds
value = intSeconds;
aDegreesString.AppendNum(value);
// Add the separator
aDegreesString.Append(KDelimQuot);
// Add the separator
aDegreesString.Append(KDelimDot);
// Get six last digits
realSeconds -= intSeconds;
realSeconds *= 1000;
// Add the seconds
aDegreesString.AppendNumFixedWidth(static_cast<TInt>(realSeconds),
EDecimal, KNumWidth);
}
}
IN side handle command in unregisterview under switch case i called ...
case ELocation:
{
iSearchLocation = CLocation::NewL(1000000*10,*this); //This is the pointer of CLocation* iSearchLocation;
TPositionInfoBase* pos = iSearchLocation->CurrentPosition();
PositionUpdatedL(*pos);
}
break;
PositionUpdatedL(*pos); is defined in upper section.
I am getting error of ekern exe3 in the line
TPositionInfoBase* pos = iSearchLocation->CurrentPosition();
Please help..
Thanks in advance.

Reply With Quote

