void CSmsSendRecvTest::TestParseL()
{
    const TMsvId id = iEntryObserver->LastReceived();

    iSmsTest.SetEntryL(id);

    if (iSaveToFile)
    {
        iSmsTest.Printf(_L("Saving BIO message to file\n"));
        iSmsTest.SaveBodyToFileL(id);
    }

    CSmsHeader* header = iSmsTest.GetHeaderLC(id);
    CSmsDeliver& pdu = header->Deliver();

    TBool found = EFalse;
    TInt destination, originator, is16Bit;
    destination = originator = is16Bit = 0;
    if (pdu.UserDataPresent())
    {
        const CSmsUserData& userData = pdu.UserData();
        TInt count = userData.NumInformationElements();
        iSmsTest.Printf(_L("Pdu contains %d information elements\n"), count);
        while (!found && count--)
        {
            CSmsInformationElement& nextIE=userData.InformationElement(count);
            switch(nextIE.Identifier())
            {
            case CSmsInformationElement::ESmsIEIApplicationPortAddressing8Bit:
            case CSmsInformationElement::ESmsIEIApplicationPortAddressing16Bit:
            {
                pdu.ApplicationPortAddressing(destination, originator, &is16Bit);
                found = ETrue;
                break;
            }
            default:
                break;
            }
        }
    }

    CleanupStack::PopAndDestroy(header);

    if (found)
        iSmsTest.Printf(_L("Application Port Addressing: Dest %d, Origin %d, is16Bit %d\n"), destination, originator, is16Bit);
    else
        iSmsTest.Printf(_L("Application Port Addressing: Not Found\n"));

    if (!iParse)
        return;

    if (!iSmsTest.Entry().iBioType)
        return;

    iState = EStateParsing;

    iSmsTest.Printf(_L("Parsing BIO message\n"));

    CMsvEntrySelection* sel = new (ELeave) CMsvEntrySelection();
    CleanupStack::PushL(sel);

    sel->AppendL(id);

    delete iOperation;
    iOperation = NULL;

    iOperation = Session().TransferCommandL(*sel, KBiosMtmParse, KNullDesC8, iStatus);
    SetActive();

    CleanupStack::PopAndDestroy(sel);
}