Hi,
i need to read title of message bluetooth.
I send a text file, I try to read with command "idescription" but field is empty.
Write my code:
Code:void CSmsHandler::SetMtmEntryL(TMsvId aEntryId) { //Get the server entry from our session CMsvEntry* entry = iSession->GetEntryL(aEntryId); CleanupStack::PushL(entry); //Check if our mtm is different from the mtm set to our entry if ((iMtm == NULL) || (entry->Entry().iMtm != (iMtm->Entry()).Entry().iMtm)) { //If so, we delete the old... delete iMtm; iMtm = NULL; // ...and get a new one from the MtmRegistry iMtm = iMtmRegistry->NewMtmL(entry->Entry().iMtm); } iMtm->SetCurrentEntryL(entry); CleanupStack::Pop(entry); } TBool CSmsHandler::GetBluetoohAttachment( TMsvId aMessageId) { _LIT(KBluetoothMessage, "Bluetooth"); //CEikonEnv::Static()->AlertWin(_L("start"),KBluetoothMessage); SetMtmEntryL(aMessageId); iMtm->LoadMessageL(); TMsvEntry MsvEntry = iMtm->Entry().Entry(); TBufC<20> itext(MsvEntry.iDetails); if( itext == KBluetoothMessage) { // CEikonEnv::Static()->AlertWin(_L("dentro if"),KBluetoothMessage); CMsvEntry& btEntry = iMtm->Entry(); CMsvEntrySelection* btChildren = btEntry.ChildrenL(); if (btChildren->Count() >= 1) { TMsvId btAtt = (*btChildren)[0]; btEntry.SetEntryL(btAtt); // switch context to CHILD entry TBufC<20> itext3(MsvEntry.iDetails); TBufC<20> itext2(MsvEntry.iDescription); CEikonEnv::Static()->AlertWin(itext3,itext2); if (btEntry.HasStoreL()) { CEikonEnv::Static()->AlertWin(_L("if 1"),_L("1")); CMsvStore* store = btEntry.ReadStoreL(); CleanupStack::PushL(store); CRichText* richText = CRichText::NewL( CEikonEnv::Static()->SystemParaFormatLayerL(), CEikonEnv::Static()->SystemCharFormatLayerL()); richText->Reset(); CleanupStack::PushL(richText); if (store->HasBodyTextL()) { CEikonEnv::Static()->AlertWin(_L("if 2"),_L("2")); // Get the SMS body text. store->RestoreBodyTextL(*richText); TPtrC ptr; TCharFormat aFormat; richText->GetChars(ptr,aFormat,0); CEikonEnv::Static()->AlertWin(_L("rich"), _L("store->HasBodyTextL()" )); } else { CEikonEnv::Static()->AlertWin(_L("else 1"),_L("1")); MMsvAttachmentManager& iAttMangr=store->AttachmentManagerL(); RFile attFile=iAttMangr.GetAttachmentFileL(0); TBuf8<256> attFileBuf; attFile.Read(attFileBuf); attFile.Close(); TBuf<223>a; a.Copy(attFileBuf); } CleanupStack::PopAndDestroy(richText); CleanupStack::PopAndDestroy(store); } else { return EFalse; } } } return ETrue; }
My application return false, why??
Another question: How to know the device bluetooth that send this message?
Many thanks
Silvia






