void CLocationEngine::InsertIntoPayload(TInt aPosition, const TDesC8& aString, TPtr8& aLogStanza) { if(aLogStanza.Length() + aString.Length() > aLogStanza.MaxLength()) { iLogStanza = iLogStanza->ReAlloc(aLogStanza.MaxLength() + aString.Length() + 32); aLogStanza.Set(iLogStanza->Des()); } aLogStanza.Insert(aPosition, aString); }
// The caller must free the returned buffer. The buffer is guaranteed // to have a zero terminator. HBufC8* ConvToUtf8ZL(const TDesC& name16) { // Note that there is no non-leaving variant of this function, such // that the result has no maximum size. // // Do not know what happens if any 0 values appear in "name16"; this // is not documented. HBufC8* name8 = CnvUtfConverter::ConvertFromUnicodeToUtf8L(name16); // Ensure there is a zero terminator. Quite a lot of work to do this // efficiently. TPtr8 ptr = name8->Des(); if (ptr.Length() < ptr.MaxLength()) { ptr.PtrZ(); // modifies HBufC8 content } else { HBufC8* bigger8 = name8->ReAlloc(ptr.Length() + 1); if (bigger8) { name8 = bigger8; // name8 already deleted by ReAlloc name8->Des().PtrZ(); // modifies HBufC8 content } else { delete name8; User::Leave(KErrNoMemory); } } return name8; }
// ----------------------------------------------------------------------------- // CCapInfo::WriteL(const TDesC& aText) // Writes one element to capability buffer. // ----------------------------------------------------------------------------- // void CCapInfo::WriteL(const TDesC& aText) { if (aText.Length() > iBuf.MaxLength()) { User::Leave(KErrTooBig); } iBuf=aText; iBuf.Trim(); FormatElement(iBuf); TPtr8 ptr = iHeapBuf->Des(); if ( iBuf.Length()+2 > ptr.MaxLength() ) { User::Leave(KErrTooBig); } //unicode conversion HBufC8* convBuf = HBufC8::NewLC( iBuf.Size() ); TPtr8 convPtr = convBuf->Des(); CnvUtfConverter::ConvertFromUnicodeToUtf8(convPtr, iBuf); ptr.Copy(convPtr); ptr.Append( KLineFeed ); // linefeed CleanupStack::PopAndDestroy( convBuf ); TInt pos=iCapabilityBuf->Size(); iCapabilityBuf->InsertL(pos, ptr); iBuf=KNullDesC; }
EXPORT_C int WstringToTptr8(wstring& aSrc, char* cPtr, TPtr8& aDes) { int retval = ESuccess; unsigned int wlen = 0, ilendes = 0; const wchar_t* wcharString = aSrc.c_str(); int minusone = -1; if (L'\0' == wcharString[0]) { return EStringNoData; } wlen = wcslen(wcharString); ilendes = aDes.MaxLength(); if (ilendes < 2*wlen) { return EInsufficientMemory; } if(minusone != wcstombs(cPtr, wcharString, wlen*2)) { aDes.Set((unsigned char *)cPtr, wlen*2, ilendes); } else { retval = EInvalidWCSSequence; } return retval; }
void CDHCPIP6Control::GetRawOptionDataL(TUint aOpCode, TPtr8& aPtr ) { HBufC8* buf = NULL; DHCPv6::CDHCPMessageHeaderIP6 msg(buf); CleanupClosePushL(msg); TPtr8 ptr( const_cast<TUint8*>(iValidMsg.Ptr()), iValidMsg.Length(), iValidMsg.Length() ); msg.iRecord.ParseL(ptr); //no check necessary DHCPv6::COptionNode* pOption = msg.GetOptions().FindOption(aOpCode); if (!pOption) { #ifdef SYMBIAN_TCPIPDHCP_UPDATE // The option is not found try to get the option through DHCP INFORM message //by calling RequestInformOrCompleteCallL CleanupStack::PopAndDestroy(); TUint opcode = aOpCode; TPtr8 optPtr(reinterpret_cast<TUint8*>(&opcode),1,1); return(RequestInformOrCompleteCallL(optPtr)); #else User::Leave(KErrNotFound); #endif //SYMBIAN_TCPIPDHCP_UPDATE } ptr.Set(pOption->GetBodyDes()); if (ptr.Length() > aPtr.MaxLength()) { User::Leave(KErrOverflow); } aPtr.Copy(ptr); CleanupStack::PopAndDestroy(); }
void CZipFileDecompressor::DecompressNextMemberL(CZipFileMember& aMember) { __ASSERT_ALWAYS(!iUncompressedFile.SubSessionHandle(), User::Invariant()); __ASSERT_ALWAYS(!iUncompressedData, User::Invariant()); //Ignore entries that has zero uncompressed size. //(This includes e.g. directories) if (aMember.UncompressedSize() > 0) { const TChar KDirectorySeparator('\\'); TUint32 uncompressedSize = aMember.UncompressedSize(); HBufC8* uncompressedData = HBufC8::NewLC(uncompressedSize); RZipFileMemberReaderStream* readerStream; User::LeaveIfError(iZipFile->GetInputStreamL(&aMember, readerStream)); CleanupStack::PushL(readerStream); TPtr8 uncompressedDataPtr = uncompressedData->Des(); User::LeaveIfError(readerStream->Read(uncompressedDataPtr, uncompressedDataPtr.MaxLength())); CleanupStack::PopAndDestroy(readerStream); HBufC* fileName = aMember.Name()->AllocLC(); TPtr fileNamePtr= fileName->Des(); TInt lastDirectorySeparator = fileName->LocateReverse(KDirectorySeparator); if (lastDirectorySeparator >= 0) { fileNamePtr = fileName->Mid(lastDirectorySeparator+1); } TParsePtr fileNameParser(fileNamePtr); User::LeaveIfError(iUncompressedFile.Replace(iFileServer, fileNameParser.NameAndExt(), EFileWrite)); CleanupStack::PopAndDestroy(fileName); CleanupStack::Pop(uncompressedData); iUncompressedData = uncompressedData; iUncompressedFile.Write(*iUncompressedData, iStatus); SetActive(); } else { iStatus = KRequestPending; SetActive(); TRequestStatus* ownStatus = &iStatus; User::RequestComplete(ownStatus, KErrNone); } }
// ----------------------------------------------------------------------------- // AppendBufL // ----------------------------------------------------------------------------- // void AppendBufL( TPtr8& aDest, HBufC8* aSrc ) { TInt length = aSrc ? aSrc->Length() : KNullBuffer; APPEND_BUF_INT( aDest, length ); if( length > 0 ) { __ASSERT_DEBUG( (aDest.MaxLength() - aDest.Length()) > length, User::Panic( KNullDesC, KErrTooBig ) ); aDest.Append( *aSrc ); } }
void CSecureSocketReader::IssueRead() { SUPLLOG(ELogP1, "CSecureSocketReader::IssueRead() Begin\n"); if (!IsActive()) { TPtr8 ptr = iBuffer.MidTPtr(iReadSoFar); iPtr.Set(const_cast<TUint8*>(ptr.Ptr()), 0, ptr.MaxLength()); iSocket.RecvOneOrMore(iPtr, iStatus, iBufferRead); SetActive(); } SUPLLOG(ELogP1, "CSecureSocketReader::IssueRead() End\n"); }
// Call Symbian random generator void doRandomizeL(unsigned char* buffer, size_t length) { HBufC8* hbuf = HBufC8::NewLC(length); TPtr8 ptr = hbuf->Des(); ptr.FillZ(ptr.MaxLength()); CSystemRandom* rand=CSystemRandom::NewLC(); rand->GenerateBytesL(ptr); memcpy(buffer, hbuf->Ptr(), length); CleanupStack::PopAndDestroy(rand); CleanupStack::PopAndDestroy(hbuf); }
// ----------------------------------------------------------------------------- // AppendBufL // ----------------------------------------------------------------------------- // void AppendBufL( TPtr8& aDest, HBufC* aSrc ) { TInt length = aSrc ? aSrc->Length() * 2 : KNullBuffer; APPEND_BUF_INT( aDest, length ); if( length > 0 ) { TPtr8 tmp8( (TUint8*)aSrc->Ptr(), length, length); __ASSERT_DEBUG( (aDest.MaxLength() - aDest.Length()) > tmp8.Length() , User::Panic( KNullDesC, KErrTooBig ) ); aDest.Append( tmp8 ); } }
void CBTHidConnection::GetReportL(TUint8 aReportType, TUint8 aReportID, TUint16 aLength) { LeaveIfCommandNotReadyL(); iCommandBuffer.Zero(); // Add the Transaction header byte // Report Type 0 = Reserved // Report Type 1 = Input // Report Type 2 = Output // Report Type 3 = Feature iCommandBuffer.Append(EGetReportFullBufReserved + aReportType); // If Report ID's are declared in the report descriptor then we // add this field if (aReportID != 0) { iCommandBuffer.Append(aReportID); } // We need to check we have a buffer large enough to hold the control // data we get back from the device if (!iControlDataBuffer) { // Allocate the buffer if it didn't exist iControlDataBuffer = HBufC8::NewL(aLength); } else { // Get a modifiable pointer to the buffer. TPtr8 dataPtr = iControlDataBuffer->Des(); if (dataPtr.MaxLength() < aLength) { // Reallocate the buffer if its too small. delete iControlDataBuffer; iControlDataBuffer = 0; iControlDataBuffer = HBufC8::NewL(aLength); } else { // Existing buffer is large enough, just zero it. dataPtr.Zero(); } } iControlSocketWriter->IssueWriteL(iCommandBuffer); iCommandIssued = ETrue; }
void CProtocolExadump::DoPacket(const RMBufPacketBase &aPacket, const RMBufPktInfo &aInfo) /** * Dump the packet. * * This is called for both incoming and outgoing packets, from the * respective ApplyL methods. * * @param aPacket The packet data * @param aInfo The packet inforrmation */ { /** @code */ // Open the dump file, if not already opened (or attempted). if (iOpen == 0) DoOpen(1500); if (iOpen < 0) return; // cannot open output file. // // Build PCAP frame into iBuffer (pcap_pkthdr + snapped portion of the packet) // TPtr8 buf = iBuffer->Des(); struct pcap_pkthdr *const hdr = (struct pcap_pkthdr *)buf.Ptr(); TPtr8 ptr((TUint8 *)buf.Ptr() + sizeof(*hdr), buf.MaxLength() - sizeof(*hdr)); const TInt snap = aInfo.iLength > ptr.MaxLength() ? ptr.MaxLength() : aInfo.iLength; ptr.SetLength(snap); aPacket.CopyOut(ptr); hdr->caplen = snap; hdr->len = aInfo.iLength; TTime stamp; stamp.UniversalTime(); const TTimeIntervalMicroSeconds elapsed = stamp.MicroSecondsFrom(iBase); #ifdef I64INT hdr->ts.tv_usec = I64INT(elapsed.Int64() % 1000000); hdr->ts.tv_sec = I64INT(elapsed.Int64() / 1000000); #else hdr->ts.tv_usec = (elapsed.Int64() % 1000000).GetTInt(); hdr->ts.tv_sec = (elapsed.Int64() / 1000000).GetTInt(); #endif // // Write frame out. // iDumpFile.Write(buf, snap+sizeof(*hdr)); /** @endcode */ }
/** EncodeToL() Encode a populated outgoing message to the specified buffer. @param aBuf buffer pointer @return error indication, KErrNone otherwise */ EXPORT_C TInt CSuplMessageBase::EncodeToL(TPtr8& aBuf) { SUPLLOG(ELogP1, "CSuplMessageBase::EncodeToL() Begin\n"); __ASSERT_DEBUG(iIsOutgoingMessage, User::Invariant()); TInt retval = KErrNone; // buffer pointer, fixed max length TUint8* msgBuf = (TUint8*)aBuf.Ptr(); TInt maxLength = aBuf.MaxLength(); // Log the un-encoded SUPL values SUPLLOG(ELogP9, "-> ENCODING SUPL MESSAGE FOR SENDING\n"); //LogMessageContent(); // if the message is a SUPL POS, encode the payload if (iData->message.t == T_UlpMessage_msSUPLPOS) { CSuplPos* suplPos = reinterpret_cast <CSuplPos*>(this); retval = suplPos->EncodePosPayloadL(); if (retval != KErrNone) { SUPLLOG(ELogP1, "CSuplMessageBase::EncodeToL() Error encoding Positioning Payload\n"); return retval; } } // construct the encode buffer control object iEncodeBuffer = new (ELeave) ASN1PEREncodeBuffer (msgBuf, (unsigned int)maxLength, FALSE, (OSRTContext*)iControl->getContext()); // Encode the message to the buffer TInt stat = iControl->EncodeTo(*iEncodeBuffer); if (stat == 0) { // Set the length according to reported buffer length TInt len = iEncodeBuffer->getMsgLen (); iData->length = len; aBuf.SetLength(len); // clear the encoded length field msgBuf[0] = 0; msgBuf[1] = 0; // set the encoded length field msgBuf[0] |= (TUint8)( len >> 8 ); msgBuf[1] |= (TUint8)( len ); }
// ----------------------------------------------------------------------------- // TSnapshotItem::CreateHashL // Create hash value from group content // ----------------------------------------------------------------------------- void TSnapshotItem::CreateHashL( CContactGroup& aGroup ) { CMessageDigest* hash = CMessageDigestFactory::NewDigestLC( CMessageDigest::EMD5 ); if ( aGroup.HasItemLabelField() ) { TPtrC label = aGroup.GetGroupLabelL(); HBufC8* tempBuf = CnvUtfConverter::ConvertFromUnicodeToUtf8L( label ); CleanupStack::PushL( tempBuf ); hash->Update( tempBuf->Des() ); CleanupStack::PopAndDestroy( tempBuf ); } // Create text field from items on group CContactIdArray* contactsIdArray = aGroup.ItemsContainedLC(); const TInt idBufferMaxSize( 400 ); HBufC8* tempIdBuf = HBufC8::NewLC( idBufferMaxSize ); TPtr8 tempId = tempIdBuf->Des(); const TInt KMaxNumLength(5); if ( contactsIdArray ) // this is NULL if there are no objects { tempId.AppendNum( contactsIdArray->Count(), EHex ); for (TInt i=0; i< contactsIdArray->Count(); i++ ) { if ( tempId.Length()+KMaxNumLength > tempId.MaxLength() ) { // buffer is almost full, don't add any new items LOGGER_WRITE("buffer full"); break; } // add item id tempId.AppendNum( (*contactsIdArray)[i] , EHex ); } } else { tempId.AppendNum( 0 ); } // update hash hash->Update( tempId ); iHash.Copy( hash->Final() ); CleanupStack::PopAndDestroy( tempIdBuf ); CleanupStack::PopAndDestroy( contactsIdArray ); CleanupStack::PopAndDestroy( hash ); }
TVideoInputBuffer* CMMFTestVideoDecodeHwDevice::GetBufferL(TUint aBufferSize) { if (!iBufferDataArea) { TPtrC8 testBufferString(KTestBufferString); iBufferDataArea = testBufferString.AllocL(); } TPtr8 dataAreaPtr = iBufferDataArea->Des(); TInt reqBufferSize = aBufferSize; if (reqBufferSize > dataAreaPtr.MaxLength()) User::Leave(KErrTooBig); // initialize iInputBuffer with test data iInputBuffer.iOptions = KTestBufferOptions; iInputBuffer.iDecodingTimestamp = aBufferSize; iInputBuffer.iData.Set(dataAreaPtr); // call new buffer callback iProxy->MdvppNewBuffers(); return &iInputBuffer; }
static void TblCallTestL() { TheTest.Next(_L("Open()")); TInt err = TheTbl1.Open(TheDb1, KTableName1); TEST2(err, KErrNone); TheTest.Next(_L("ColSetL()")); CDbColSet* colset = TheTbl1.ColSetL(); TInt cnt = colset->Count(); TInt i; for(i=0;i<cnt;++i) { const TDbCol& dbc = (*colset)[i + 1]; TheTest.Printf(_L("%02d, %S\n"), i + 1, &dbc.iName); } delete colset; TheTest.Next(_L("ColDef()")); TDbCol dbcol = TheTbl1.ColDef(1); TheTest.Printf(_L("%S\n"), &dbcol.iName); TheTest.Next(_L("InsertL()/SetColL()/PutL()")); TheTbl1.InsertL(); TheTbl1.SetColL(2, 1); TheTbl1.SetColL(3, 2); TheTbl1.PutL(); TheTbl1.InsertL(); TheTbl1.SetColL(2, 3); TheTbl1.SetColL(3, 4); TheTbl1.PutL(); TheTest.Next(_L("AtRow()/AtBeginning()/AtEnd()")); (void)TheTbl1.AtRow(); (void)TheTbl1.AtBeginning(); (void)TheTbl1.AtEnd(); TheTest.Next(_L("BeginningL()/EndL()")); TheTbl1.BeginningL(); TheTbl1.EndL(); TheTest.Next(_L("FirstL()/LastL()/PreviousL()/PreviousL()")); TBool res = TheTbl1.FirstL(); TEST(res); TheTbl1.GetL(); TInt32 val1 = TheTbl1.ColInt32(1); TInt32 val2 = TheTbl1.ColInt32(2); TInt32 val3 = TheTbl1.ColInt32(3); TEST(val1 == 0); TEST(val2 == 1); TEST(val3 == 2); res = TheTbl1.LastL(); TEST(res); TheTbl1.GetL(); val1 = TheTbl1.ColInt32(1); val2 = TheTbl1.ColInt32(2); val3 = TheTbl1.ColInt32(3); TEST(val1 == 1); TEST(val2 == 3); TEST(val3 == 4); res = TheTbl1.PreviousL(); TEST(res); TheTbl1.GetL(); val1 = TheTbl1.ColInt32(1); val2 = TheTbl1.ColInt32(2); val3 = TheTbl1.ColInt32(3); TEST(val1 == 0); TEST(val2 == 1); TEST(val3 == 2); res = TheTbl1.NextL(); TEST(res); TheTbl1.GetL(); val1 = TheTbl1.ColInt32(1); val2 = TheTbl1.ColInt32(2); val3 = TheTbl1.ColInt32(3); TEST(val1 == 1); TEST(val2 == 3); TEST(val3 == 4); TheTest.Next(_L("UpdateL()")); TheTbl1.UpdateL(); TheTbl1.SetColL(2, 33); TheTbl1.SetColL(3, 44); TheTbl1.PutL(); TheTest.Next(_L("Cancel()")); TheTbl1.UpdateL(); TheTbl1.SetColL(2, 36); TheTbl1.SetColL(3, 47); TheTbl1.Cancel(); TheTest.Next(_L("DeleteL()")); TheTbl1.DeleteL(); TheTest.Next(_L("IsColNull()")); CDbColSet* colset2 = TDBSCUtils::CreateColSetLC(KColumns2); _LIT(KTempTblName, "TempTbl"); err = TheDb1.CreateTable(KTempTblName, *colset2); TEST2(err, KErrNone); CleanupStack::PopAndDestroy(colset2); err = TheTbl2.Open(TheDb1, KTempTblName); TEST2(err, KErrNone); TheTbl2.InsertL(); _LIT8(KTestData, ""); TheTbl2.SetColL(2, KTestData); TheTbl2.PutL(); TheTbl2.Close(); err = TheTbl2.Open(TheDb1, KTempTblName); TEST2(err, KErrNone); res = TheTbl2.FirstL(); TEST(res); TheTbl2.GetL(); res = TheTbl2.IsColNull(2); TEST(res); TheTbl2.Close(); TheTest.Next(_L("ColSize()")); res = TheTbl1.FirstL(); TEST(res); TheTbl1.GetL(); res = TheTbl1.ColSize(1); TEST(res); TheTest.Next(_L("ColLength()")); TInt len = TheTbl1.ColLength(1); TEST(len > 0); TheTbl1.InsertL(); TheTbl1.SetColL(2, 3); TheTbl1.SetColL(3, 4); TheTbl1.PutL(); TheTest.Next(_L("GotoL(TPosition)")); res = TheTbl1.GotoL(RDbRowSet::EFirst); TEST(res); TheTest.Next(_L("Bookmark()/GotoL(TDbBookmark)")); TDbBookmark bkmk = TheTbl1.Bookmark(); res = TheTbl1.NextL(); TEST(res); TheTbl1.GotoL(bkmk); TheTbl1.GetL(); val1 = TheTbl1.ColInt32(1); TEST(val1 == 0); TheTest.Next(_L("CountL()/IsEmptyL()")); cnt = TheTbl1.CountL(); TEST(cnt == 2); res = TheTbl1.IsEmptyL(); TEST(!res); TheTest.Next(_L("MatchL()")); RDbRowConstraint match; CleanupClosePushL(match); err = match.Open(TheTbl1, TDbQuery(_L("ID > 0"))); TEST2(err, KErrNone); res = EFalse; TheTbl1.BeginningL(); while(TheTbl1.NextL()) { if(TheTbl1.MatchL(match)) { res = ETrue; } } CleanupStack::PopAndDestroy(&match); TEST(res); TheTest.Next(_L("FindL()")); res = TheTbl1.FirstL(); TEST(res); err = TheTbl1.FindL(RDbRowSet::EForwards, TDbQuery(_L("ID <> 0"))); TEST(err >= 0); TheTbl1.GetL(); val1 = TheTbl1.ColInt32(1); TEST(val1 > 0); _LIT8(KTestData2, "0123456789"); HBufC8* buf = HBufC8::NewLC(10000); TPtr8 ptr = buf->Des(); for(i=0;i<1000;++i) { ptr += KTestData2(); } TheTest.Next(_L("RDbColReadStream")); err = TheTbl2.Open(TheDb1, KTempTblName); TEST2(err, KErrNone); TheTbl2.InsertL(); TheTbl2.SetColL(2, *buf); TheTbl2.PutL(); TheTbl2.InsertL(); TheTbl2.SetColL(2, KTestData2); TheTbl2.PutL(); res = TheTbl2.PreviousL(); TEST(res); TheTbl2.GetL(); RDbColReadStream rstream; rstream.OpenLC(TheTbl2, 2); ptr.Zero(); rstream.ReadL(ptr, ptr.MaxLength()); CleanupStack::PopAndDestroy(&rstream); TEST(ptr.Length() == ptr.MaxLength()); TheTest.Next(_L("RDbColWriteStream")); TheTbl2.InsertL(); RDbColWriteStream wstream; wstream.OpenLC(TheTbl2, 2); wstream.WriteL(ptr, ptr.Length()); wstream.CommitL(); CleanupStack::PopAndDestroy(&wstream); TheTbl2.PutL(); TheTbl2.Close(); CleanupStack::PopAndDestroy(buf); TheTbl1.Close(); }
void CGpsDataHandler::RunL() { #ifndef __SERIES60_3X__ TPtr8 pBuffer = iBuffer->Des(); THostName aHostName; TInquirySockAddr aInquiry; TInt aServiceClass; switch(iEngineStatus) { case EGpsResolving: if(iStatus == KErrNone) { // Next device found aHostName = iNameEntry().iName; aInquiry = TInquirySockAddr::Cast(iNameEntry().iAddr); aServiceClass = aInquiry.MajorServiceClass(); iBTAddr.SetBTAddr(aInquiry.BTAddr()); iBTAddr.SetPort(1); if(aServiceClass & 0x08 || aHostName.Find(_L("GPS")) != KErrNotFound || aHostName.Find(_L("gps")) != KErrNotFound) { // Found Positioning device if(iSocket.Open(iSocketServ, KBTAddrFamily, KSockStream, KRFCOMM) == KErrNone) { iEngineStatus = EGpsConnecting; //iResolver.Close(); iSocket.Connect(iBTAddr, iStatus); SetActive(); } else { iSocketServ.Close(); iEngineStatus = EGpsDisconnected; iObserver->GpsError(EGpsConnectionFailed); } } else { // Get next iResolver.Next(iNameEntry, iStatus); SetActive(); } // TODO - Is correct device? } else if(iStatus == KErrHostResNoMoreResults) { // No (more) devices found iSocketServ.Close(); iEngineStatus = EGpsDisconnected; iGpsDeviceResolved = false; iObserver->GpsError(EGpsDeviceUnavailable); } else { iSocketServ.Close(); iEngineStatus = EGpsDisconnected; iObserver->GpsError(EGpsDeviceUnavailable); } break; case EGpsConnecting: if(iStatus == KErrNone) { iEngineStatus = EGpsReading; iGpsDeviceResolved = true; iResolver.Close(); pBuffer.Zero(); iSocket.Recv(iChar, 0, iStatus); SetActive(); } else { if(iGpsDeviceResolved) { iSocket.Close(); iSocketServ.Close(); iEngineStatus = EGpsDisconnected; iObserver->GpsError(EGpsConnectionFailed); } else { // Get next iEngineStatus = EGpsResolving; iResolver.Next(iNameEntry, iStatus); SetActive(); } } break; case EGpsReading: if(iStatus == KErrNone) { iEngineStatus = EGpsConnected; if(pBuffer.Length() + iChar.Length() > pBuffer.MaxLength()) { iBuffer = iBuffer->ReAlloc(pBuffer.MaxLength()+iChar.Length()); pBuffer.Set(iBuffer->Des()); } pBuffer.Append(iChar); ProcessData(); } else { iSocket.Close(); iSocketServ.Close(); iEngineStatus = EGpsDisconnected; iObserver->GpsError(EGpsConnectionFailed); } break; case EGpsDisconnecting: iResolver.Close(); iSocket.Close(); iSocketServ.Close(); iEngineStatus = EGpsDisconnected; break; default:; } #else switch(iEngineStatus) { case EGpsReading: iEngineStatus = EGpsConnected; if(iStatus == KErrNone) { TPosition aPosition; iPositionInfo.GetPosition(aPosition); iObserver->GpsData(aPosition.Latitude(), aPosition.Longitude(), aPosition.HorizontalAccuracy()); if( !iGpsWarmedUp ) { iGpsWarmedUp = true; TPositionUpdateOptions aOptions; aOptions.SetUpdateTimeOut(30000000); aOptions.SetAcceptPartialUpdates(true); iPositioner.SetUpdateOptions(aOptions); } } else { iObserver->GpsError(EGpsDeviceUnavailable); } break; case EGpsDisconnecting: iPositioner.Close(); iPositionServ.Close(); iEngineStatus = EGpsDisconnected; break; default:; } #endif }