×

Discussion Board

Results 1 to 12 of 12
  1. #1
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    57

    reading and replying to sms automatically

    i have an application that reads incoming sms messages via MMsvSessionObserver derived class. another MMsvSessionObserver derived class which is also an Active object (derived from CActive) is responsible for sending replies back. the flow is like this:

    1) reader class receives incoming sms, copies the message onto a queue, and calls SetActive() on the sender class.
    2) the sender class dequeues the msg and sends a reply back to the sender.

    the problem: this works successfully ONCE. when the second sms arrives, the machinery above does not kick in. also, if i inject a CEikonEnv::InfoWinL() call when i receive a msg, it works ALL THE TIME. i'm not sure why this call to InfoWinL() is helping to make things work...

  2. #2
    Regular Contributor
    Join Date
    Mar 2003
    Location
    India
    Posts
    63

    Could you please help me

    Hello,

    I need to find out the count of sent/received SMS. For this i think i need to write an active object which should track the SMS event whenever there is an SMS incoming/outgoing.
    My question is how to write this active object? how to track this event? Say if i put a thread in my application which will keep track of this event, does it work? In your post you said that u are able to track incoming/outgoing of SMS. could you please send me that code?

    And one more question is, i want to find out the size of data coming in and going out of the mobile? how do we find out this?

    I am using Series 60 SDK and for Nokia 7650 model.

    Please send me a code snippet if possible to chavasekhar@rediffmail.com.

    thanks in advance.

    rajasekhar

  3. #3
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    57
    the missing classes are from the 9200 sdk. specifically, the header file etelbgsm.h. download this sdk and grab the file from the include directory. go here:

    http://www.forum.nokia.com/symbianfo..._32_15,00.html

    and download:

    SMS Sending Example Application v1.4 for Nokia 9200 Communicator Series

    this will show you how to do everything

  4. #4
    Regular Contributor
    Join Date
    Mar 2003
    Location
    India
    Posts
    63

    KUidMsgTypeSMS undeclared identifier

    Hello,

    I have gone through the SMS sending example. I found a method HandleSessionEventL() and rest of the code is depended on the arguments of that method.

    But in my case i dont want any active object, sending or receiving SMS. All i need is at the end of the day my application should find out the SMS's sent/received from the device and for each SMS i have to read the header information. For this i hope i no need to use the HandleSessionEventL().

    I am using the following code: Please take a look at it.

    Code:
    ---------
    CMsvSession* iSession = CMsvSession::OpenSyncL(*this);
    CClientMtmRegistry* iMtmReg = CClientMtmRegistry::NewL(*iSession);
    CBaseMtm* iMtm;

    TMsvSelectionOrdering sort;
    sort.SetShowInvisibleEntries(ETrue); // we want to handle also the invisible entries
    // Take a handle to the Inbox entry
    CMsvEntry* parentEntry = CMsvEntry::NewL(*iSession, KMsvGlobalInBoxIndexEntryId, sort);
    CleanupStack::PushL(parentEntry);

    CMsvEntrySelection* entries = parentEntry->ChildrenL(); // A selection of all the entries of the Inbox
    CleanupStack::PushL(entries);
    TInt iCount;
    // go through all entries in the Inbox
    for(TInt i = 0; i < entries->Count(); i++)
    {
    if( parentEntry->ChildDataL(entries->At(i)).iMtmData3 == KUidMsgTypeSMS ) // check that message is for GDSMS
    iCount+=1;
    CleanupStack::PopAndDestroy(2); // entries, parentEntry
    }
    ---------

    But when i compiled i am getting an error 'KUidMsgTypeSMS undeclared identifier'. I couldn't find any header file or information related to this constant. which header file/library i have to include for this?

    Is the code snippet is correct? Am i going in the correct way? Please make necessarry changes if necessarry changes.

    Please help me? Your input will be very helpful for me and i am running out of time.

    Is it possible for you to send me your code?

    Regards,
    Rajasekhar

  5. #5
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    57
    ok, here's some code:

    #include <msvapi.h> // CMsvSession, MMsvSessionObserver, CMsvEntry
    #include <mtclreg.h> // CClientMtmRegistry
    #include <smut.h> // KUidMsgTypeSMS
    #include <msvids.h> // KMsvGlobalInBoxIndexEntryId, KMsvSentEntryId
    #include <smsclnt.h> // CSmsClientMtm

    // you MUST have an observer to receive notifications!
    class CSmsWatcher : public MMsvSessionObserver
    {
    public:

    CSmsWatcher() : iIncoming(0), iOutgoing(0)
    {
    iSession = CMsvSession::OpenSyncL(*this);
    iMtmReg = CClientMtmRegistry::NewL(*iSession);
    }

    ~CSmsWatcher()
    {
    delete iMtmReg;
    delete iSession;
    }

    // MUST implement virtual from MMsvSessionObserver
    void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3)
    {

    bool incoming;

    switch(aEvent)
    {

    case EMsvEntriesCreated:
    {

    // we're interested in incoming and outgoing msgs
    if(*(static_cast<TMsvId*>(aArg2)) == KMsvGlobalInBoxIndexEntryId)
    incoming = true;
    else
    if(*(static_cast<TMsvId*>(aArg2)) == KMsvSentEntryId)
    incoming = false;
    else
    return; // dont care about other folders

    CMsvEntrySelection* entries = static_cast<CMsvEntrySelection*>(aArg1);
    for(TInt i = 0;i < entries->Count();i++)
    {

    TMsvId id = entries->At(i);
    CMsvEntry* entry = iSession->GetEntryL(id);
    TMsvEntry msvEntry = entry->Entry();
    CSmsClientMtm* smsMtm = STATIC_CAST(CSmsClientMtm*,
    iMtmReg->NewMtmL(msvEntry.iMtm));
    smsMtm->SwitchCurrentEntryL(id);
    TUid type = smsMtm->Type();
    if(type == KUidMsgTypeSMS)
    {

    if(incoming)
    iIncoming++;
    else
    iOutgoing++;

    // load msg and get length
    // smsMtm->LoadMessageL();
    // smsMtm->Body().Read(0).Length();

    }
    delete smsMtm;
    delete entry;

    } // end for

    } // end case
    break;

    } // end switch

    private:

    CMsvSession* iSession;
    CClientMtmRegistry* iMtmReg;
    int iIncoming;
    int iOutgoing;
    };

  6. #6
    Regular Contributor
    Join Date
    Mar 2003
    Location
    India
    Posts
    63

    How to read the Data and time

    Hello dgobin,

    So many thanks for your immediate response. I was able to find out the count of SMS's received/sent without using any active object.
    Thats ok, but i was not able to read the received/sent date and time of each SMS. i did not find any suitable method to read them. i was able to view them on the device under Message Details option of SMS. how can we access this?

    Do you have any idea on how to read the SMS date and time?

    And any idea about how to find out the size of the data sent and received?

    If you know please let me know.

    Regards,
    Rajasekhar

  7. #7
    Nokia Developer Expert
    Join Date
    Mar 2003
    Posts
    195

    SDK documentation: TMsvEntry

    Hi chavasekhar,

    The same SMS example shows you how to read this information. Please use the example in conjunction with the SDK Help documentation, especially page concerning class TMsvEntry. This will give you answers to your questions.

    Best Regards,
    Ari / Forum Nokia

  8. #8
    Regular Contributor
    Join Date
    Mar 2003
    Location
    India
    Posts
    63

    What about GPRS data size

    Hello aaumala,
    Thanks for your response.

    Which example are you talking about? is it SMS example v1.4? Can i find any useful info related to GPRS data size in that example?

    I was able to find the SMS date and time but offcourse the time values are so strange and are slightly different than the values which the device is showing.

    My biggest problem is i want to find out the GPRS sent/receive data size. These values we can see in the device under 'Log->GPRS data counter'. I think i have to read them from logs.

    Can we read those values using api? If so what are they? I dont want any active object, say at the end of the day i will read the logs and find out the size. Is it possible?


    Please help me.

    thanks in advance.

    Rajasekhar

  9. #9
    Nokia Developer Expert
    Join Date
    Mar 2003
    Posts
    195
    TMsvEntry holds entry information. So it is not the message date & size directly. CSmsMessage class would hold the actual info for SMSs but it is not in a usable form on the public SDK.

    About log, please see SDK Help.


    Ari / Forum Nokia

  10. #10
    Regular Contributor
    Join Date
    Mar 2003
    Location
    India
    Posts
    63

    I couldn't find anything

    Hello aaumala,

    I have gone through the documentation about reading logs to find out the GPRS data size. but i did not get any useful information related to that.

    Why Nokia is also not giving any response to such kind of critical issues?


    Regards,
    Rajasekhar

  11. #11
    Regular Contributor
    Join Date
    Mar 2003
    Location
    India
    Posts
    63

    How to trap outgoing SMS event(KMsvSentEntryId)

    Hello,

    I want to trap the event whenever the user sent any message from the device. I did the following code. i can identify whenever there is an SMS coming in but failed to trap outgoing sms event.

    Here is my code.

    void CSmsEvent::HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3)
    {
    bool incoming;


    switch(aEvent)
    {
    case EMsvServerReady:
    CompleteConstructL();
    break;
    case EMsvEntriesCreated:
    {
    if(*(static_cast<TMsvId*>(aArg2)) == KMsvGlobalInBoxIndexEntryId)
    {
    incoming = true;
    _LIT(m,"Incoming");
    //CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
    //informationNote->ExecuteLD(m);
    }
    else if(*(static_cast<TMsvId*>(aArg2)) == KMsvSentEntryId)
    {
    incoming = false;
    sent=1;
    _LIT(m,"OutGoing");
    CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
    informationNote->ExecuteLD(m);
    //This message is never coming up
    }
    else if(*(static_cast<TMsvId*>(aArg2)) == KMsvGlobalOutBoxIndexEntryId)
    {
    incoming = false;
    sent=2;
    _LIT(m,"KMsvGlobalOutBoxIndexEntryId");
    CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
    //This message is never coming up informationNote->ExecuteLD(m);
    }
    else
    {
    return; // dont care about other folders
    }

    CMsvEntrySelection* entries = static_cast<CMsvEntrySelection*>(aArg1);

    TInt i = 0;
    {

    TMsvId id = entries->At(i);
    CMsvEntry* entry = iSession->GetEntryL(id);
    TMsvEntry msvEntry = entry->Entry();
    CSmsClientMtm* smsMtm = STATIC_CAST(CSmsClientMtm*,iMtmReg->NewMtmL(msvEntry.iMtm));

    smsMtm->SwitchCurrentEntryL(id);
    TUid type = smsMtm->Type();

    if(type == KUidMsgTypeSMS)
    {
    TBuf<450> msess;
    smsMtm->LoadMessageL();
    CSmsHeader& smsHeader = smsMtm->SmsHeader();
    TInt len = smsMtm->Body().Read(0).Length();

    HBufC* msg = HBufC::NewL(len); CleanupStack::PushL(msg);
    TPtr pMsg = msg->Des();
    //copy sms message body
    pMsg.Copy(smsMtm->Body().Read(0, len));
    CAknInformationNote* informationNote = new (ELeave) CAknInformationNote;
    informationNote->ExecuteLD(pMsg);
    //I can display the SMS data for incoming sms, but can not display //the out sms data
    CleanupStack::PopAndDestroy(1);
    }

    delete smsMtm;
    delete entry;
    } // end for
    } // end case
    break;
    default:
    break;
    } // end switch
    }

    Where am i doing mistake? why i was not able to trap the outgoing sms event?

    Please let me know.

    Rajasekhar

  12. #12
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    57
    try case EMsvEntriesMoved

Posting Permissions

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