×

Discussion Board

Results 1 to 15 of 15

Thread: Reading a sms

  1. #1
    Regular Contributor
    Join Date
    Dec 2005
    Posts
    81

    Reading a sms

    Hi,
    Can i read a sms by using normal file reader method. Sms saved to "Mail" folder. But anyone know how to identify it?

    Amila

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,672

    Re: Reading a sms

    Yes you can (in pre-3rd edition devices), although it has no real use.
    For example an SMS with TMsvId 0x00100143 is in the file c:\System\Mail\00001001_S\3\00100143

  3. #3
    Regular Contributor
    Join Date
    Dec 2005
    Posts
    81

    Re: Reading a sms

    Hi,
    I tried to read it. But it contain nothing. Can't we get the data inside the sms.
    Also when we save a web page(Lets say *.wml file) where it save? we can see it in the "Notes" application. But i cannot find the real path.
    I'm using a "sysexplorar" located at the "newlc" site.
    Pls someone help me to find it. Its very urgent.

    Amila.

  4. #4
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,344

    Smile Re: Reading a sms

    Hello Amila,

    Why don't u read from inbox?

    Actually when i open the particular sms from ..System/Mail/.....,i can see some non-readble charcters with some readable text.
    So i don't think u can read them as u do with yr Inbox entries.
    I am not sure indeed.

    Regards.
    Kiran.

  5. #5
    Regular Contributor
    Join Date
    Dec 2005
    Posts
    81

    Re: Reading a sms

    Hi,
    Actually were is the inbox entries? If u know pls tell me.
    Amila

  6. #6
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,344

    Smile Re: Reading a sms

    Hello Amila,

    I mean to say , u can directly read from Inbox.

    Regards.
    Kiran.

  7. #7
    Super Contributor
    Join Date
    Aug 2005
    Location
    india
    Posts
    2,078

    Re: Reading a sms

    hi Amilael,kiran and all

    THis is wht i infered for the api's of sms and its containing folders

    // MSVIDS.H
    //
    // Copyright (c) 1998 Symbian Ltd. All rights reserved.
    //

    #if !defined(__MSVIDS_H__)
    #define __MSVIDS_H__
    #if !defined(__MSVSTD_HRH__)
    #include "msvstd.hrh"
    #endif
    #if !defined(__MSVSTD_H__)
    #include "msvstd.h"
    #endif

    // Predefined entry ids - values #defined in MSVSTD.HRH
    /** A NULL ID.

    This is typically used to indicate that the ID has not yet been set. It can
    also be used to "park" a CMsvServerEntry so that it doesn't lock an index
    entry. */
    const TMsvId KMsvNullIndexEntryId=KMsvNullIndexEntryIdValue;//0
    const TMsvId KMsvTempIndexEntryId=KMsvTempIndexEntryIdValue;//1
    /** ID of root entry of entire index */
    const TMsvId KMsvRootIndexEntryId=KMsvRootIndexEntryIdValue;//0x1000
    /** ID of local service (containing the standard folders) */
    const TMsvId KMsvLocalServiceIndexEntryId=KMsvLocalServiceIndexEntryIdValue;//0x1001

    /** ID of Inbox folder */
    const TMsvId KMsvGlobalInBoxIndexEntryId=KMsvGlobalInBoxIndexEntryIdValue;//0x1002
    /** ID of Outbox folder */
    const TMsvId KMsvGlobalOutBoxIndexEntryId=KMsvGlobalOutBoxIndexEntryIdValue;//0x1003
    /** ID of Draft folder */
    const TMsvId KMsvDraftEntryId=KMsvDraftEntryIdValue; //0x1004
    /** ID of Sent folder */
    const TMsvId KMsvSentEntryId=KMsvSentEntryIdValue; //0x1005
    const TMsvId KMsvDeletedEntryFolderEntryId=KMsvDeletedEntryFolderEntryIdValue;//0x1006
    const TMsvId KMsvUnknownServiceIndexEntryId=KMsvUnkownServiceIndexEntryIdValue; //0x1007
    const TMsvId KFirstFreeEntryId=0x100000;

    #endif

    The Bold lines represents the ids that the messages and the services a device is privilaged with will give u access to its folders..

    I just looked on to these and it's my guess but i will more to it soon and i read it some book of Digia publication some years back.. Will update u on this info sooon..

    Regards,
    Mateen Maldar
    "Whatever the mind can conceive and believe, the mind can achieve"

  8. #8
    Regular Contributor
    Join Date
    Dec 2005
    Posts
    81

    Re: Reading a sms

    Hi kiran,

    Actually in my inbox i have 4 messages. But by using "sysexplorer"(Got it from NewLC site) i know that it will come to the c:/system/Mail/ folder. There are numbered as 00100996, 00100997, 00100998, 00100999.
    The latest one is the 00100999. So i want to read that one. (00100999) Which means i want to read the latest sms i received; from the "c:/system/Mail/"folder. And i'm using the method that u have given me recently. (actually it was in my previous thread too/ "Scan dir", "ScanStartL" method/i think u can remember that)
    Pls tell me how to catch the latest sms. (As u can see it is the file with the highet value)
    Thanks again.
    Amila

  9. #9
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,344

    Smile Re: Reading a sms

    Hello Amila,

    Following is what i have implemeted to read Inbox entries:

    Code:
    void CYrFunc()
    {
    TBuf16<500> SMSContent; // To store the body part of SMS
    
    	TMsvSelectionOrdering sort;
    	sort.SetShowInvisibleEntries(ETrue); // we want to handle also the invisible entries
    
    	CMsvEntry* inboxContext=CMsvEntry::NewL(*iSession,KMsvGlobalInBoxIndexEntryId,sort);
    	CleanupStack::PushL(inboxContext);
    
    	CMsvEntrySelection* entries = inboxContext->ChildrenL();
    	CleanupStack::PushL( entries );
    
    	TInt msgCount= entries->Count();
    	for (TInt i=0; i<entries->Count(); i++)
    	{
    
    		TMsvId entryID = entries->At(i);
    		iSmsMtm->SwitchCurrentEntryL(entryID);
    
    		CMsvEntry* entry= iSession->GetEntryL((*entries)[i]);
    		CleanupStack::PushL(entry);
    
    		TMsvEntry entry1 =  entry->Entry();
    
     		CMsvStore* inboxStore= entry->ReadStoreL();
    		CleanupStack::PushL(inboxStore);
    		if (inboxStore->HasBodyTextL())
    		{
    
    			TBufC<50> aText(entry1.iDetails); // Gives u phone Number
    			TBuf16<20> msg;
    			msg.Copy(aText);
    	
    			CRichText& richText= iSmsMtm->Body();
    			inboxStore->RestoreBodyTextL(richText);
    			const TInt length = richText.DocumentLength();
    
    			SMSContent.Copy(richText.Read(0,length)); // Gives u actual content(Body) of SMS
    			richText.Reset();
    		}
    		else
    		{
    		// no text in SMS 
    		}
    		CleanupStack::PopAndDestroy(inboxStore);
    		CleanupStack::PopAndDestroy(entry);
    	}
    	CleanupStack::PopAndDestroy(entries);
    	CleanupStack::PopAndDestroy(inboxContext);
    }
    You shall find Ids in msvids.h.

    Have a Click:
    http://discussion.forum.nokia.com/fo...ad.php?t=88939

    Regards.
    Kiran.

  10. #10
    Regular Contributor
    Join Date
    Dec 2005
    Posts
    81

    Re: Reading a sms

    Hi,
    I tried. But when i called cYrFunc method programme is closed. Pls help me to find the file 00100999 among the files 00100996,00100997,00100998,00100999. I think u can easily do that.
    Thanks a lot again.
    Amila

  11. #11
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,344

    Smile Re: Reading a sms

    Hi Amila,

    U place this Function Code in yr SMSHandler.cpp.
    Then call it.
    U will definitely get result.

    If u still face problems, then u are welcome to ask.

    Regards.
    Kiran.

  12. #12
    Regular Contributor
    Join Date
    Dec 2005
    Posts
    81

    To kiran

    Hi,
    kiran this is also regarding the method you have given for search a file.
    Lets say i have text file which includes the text "Testing". so i want to get that file and read the text immediatly after the text "Testing". How can i do that? Pls reply soon. Congratulation for becoming a forum nokia champian.
    Thanks.
    Amila.

  13. #13
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,344

    Smile Re: Reading a sms

    Hello Amila,

    Once u get correct file, copy the data into descriptor.
    After getting content of file, u can do basic operation within that descriptor.

    You can use combination of Find(), Mid()... functions with descriptor data.

    Anyways i don't know if any spcific API is avialable to do it fast.

    Regards.
    Kiran.

  14. #14
    Regular Contributor
    Join Date
    Dec 2005
    Posts
    81

    Re: Reading a sms

    Hi, I used this code but it has problem when runnning can u help me to do this?
    amila.

    void CHelloWorldPlusAppUi::SaveToFolderL()
    {
    RFs aFs;
    aFs.Connect();
    CleanupClosePushL(aFs);
    CDesCArrayFlat* aFiles = new (ELeave) CDesCArrayFlat(4);
    CleanupStack::PushL(aFiles);

    ScanStartL(aFs, _L("C:\\"), _L("*.*"), aFiles);
    //ScanStartL(aFs, KfilePathPhone, fileName, aFiles);

    TBuf16<100> n;
    TInt cnt=aFiles->Count();

    for (TInt i=0;i<cnt;i++)
    {

    n.Copy((*aFiles)[i]); //Here u will get complete path

    CleanupStack::PopAndDestroy(aFiles);
    CleanupStack::PopAndDestroy(&aFs);

    TInt len= n.Length();
    if(len > 0 )
    {

    TBuf8<500> FirstTenChars;
    TBuf16<500> buf16;
    TInt Pos=0;
    TInt Len=500;

    RFs abFs;
    abFs.Connect();
    RFile file;
    file.Open(abFs,n,EFileRead|EFileStreamText);
    file.Seek(ESeekStart,Pos);
    buf16=file.Read(Pos,FirstTenChars,Len);
    buf16.Copy(FirstTenChars);



    TBufC16<32> str(buf16);

    _LIT16(KFind1,"ti");
    str.Find(KFind1);

    if (!KErrNotFound)
    {

    CAknInformationNote* informationNote;
    informationNote = new (ELeave) CAknInformationNote;
    informationNote->ExecuteLD(fileName);
    }else
    {
    CAknInformationNote* informationNote;
    informationNote = new (ELeave) CAknInformationNote;
    informationNote->ExecuteLD(buf16);
    break;
    }


    file.Close();
    abFs.Close();


    //DoProcessingOnFile(n);//It's yr implementation function after getting yr path
    }//end of if 1
    }//end of for loop
    }



    void CHelloWorldPlusAppUi::ScanStartL(RFs aFs, const TDesC& aPath, const TDesC& aWild, CDesCArray* aArray)
    {
    CDirScan* scan = CDirScan::NewLC(aFs);
    scan->SetScanDataL(aPath, KEntryAttDir|KEntryAttMatchExclusive, ESortNone, CDirScan::EScanDownTree);

    FOREVER
    {
    CDir* dir = NULL;
    TRAPD(error, scan->NextL(dir));
    if (error || !dir)
    break;

    delete dir;

    ScanDirL(aFs, scan->FullPath(), aWild, aArray);
    };
    CleanupStack::PopAndDestroy(scan);
    }

    void CHelloWorldPlusAppUi::ScanDirL(RFs& aFs, const TDesC& aDir, const TDesC& aWild, CDesCArray* aArray)
    {
    TParse parse;
    parse.Set(aWild, &aDir, NULL);
    TPtrC spec(parse.FullName());

    TFindFile find(aFs);
    CDir* dir;

    if (!find.FindWildByPath(parse.FullName(), NULL, dir))
    {
    CleanupStack::PushL(dir);

    for(TInt i = 0; i < dir->Count(); i++)
    {
    parse.Set((*dir)[i].iName, &spec, NULL);
    aArray->AppendL(parse.FullName());
    }
    CleanupStack::PopAndDestroy(dir);
    }
    }

  15. #15
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,344

    Question Re: Reading a sms

    Hello Amila,

    What errors do u get when executing the code?

    I can see some of the problem with yr code:

    1) How many times are u cleaning up the stack?
    Code:
    for(........)
    {
    .....
         CleanupStack::PopAndDestroy(aFiles);
         CleanupStack::PopAndDestroy(&aFs);
    ....
    }
    2) why r u storing TInt in TBuf16?
    buf16=file.Read(.......)
    file.Read() returns TInt, doens't it?

    etc.....

    Regards.
    Kiran.

Similar Threads

  1. Ploblems with reading SMS on nokia phones
    By MobileArt in forum Smart Messaging
    Replies: 1
    Last Post: 2005-01-18, 12:12
  2. 7650: reading SMS via AT+CPMS does not work
    By funbyclubnokia in forum General Messaging
    Replies: 6
    Last Post: 2004-06-29, 20:05
  3. HELP! problem w/ sending and reading sms..
    By mauve928 in forum General Messaging
    Replies: 0
    Last Post: 2003-12-14, 19:10
  4. Reading SMS from D211 on Linux OS.
    By panico in forum Multimodecards
    Replies: 1
    Last Post: 2002-12-05, 05:40
  5. at commands for reading sms in "My Foldes"
    By elf_legolas in forum General Messaging
    Replies: 1
    Last Post: 2002-07-15, 09:17

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×