You Are Here:

Community: Wiki

This page was last modified on 31 March 2009, at 23:02.

Sending SMS with RSendAs

From Forum Nokia Wiki

CRSendAsSender illustrates how to send SMS message using RSendAs in Symbian OS 9.x. To use it just construct the SMS sender by using the static NewL function. The first parameter is reference to the callback observer, which is used to notify when the message is sent.

aMessage argument is used to supply the message body and the aRecipients is used to supply the recipients phone number.

Note that the current implementation of the RSendAs is using default settings values (which can not really be changed) and the message body is converted to the 7-bit-sms format, and all characters that are not defined in the 7-bit-sms format will be replaced with question marks.


Contents

Library needed:

LIBRARY    sendas2.lib

RSendAs_SMS.cpp

CRSendAsSender* CRSendAsSender::NewL(MRSendSMSObserver& aObserver,const TDesC& aMessage,const TDesC& aRecipients)
{
CRSendAsSender* self = new(ELeave)CRSendAsSender(aObserver);
self->ConstructL(aMessage,aRecipients);
return self;
}
 
CRSendAsSender::CRSendAsSender(MRSendSMSObserver& aObserver):CActive(0),iObserver(aObserver)
{
}
 
CRSendAsSender::~CRSendAsSender()
{
Cancel();
iSendAsMessage.Close();
iSendAs.Close();
}
 
void CRSendAsSender::ConstructL(const TDesC& aMessage,const TDesC& aRecipients)
{
CActiveScheduler::Add(this);
 
User::LeaveIfError(iSendAs.Connect());
iSendAsMessage.CreateL(iSendAs, KUidMsgTypeSMS);
 
iSendAsMessage.AddRecipientL(aRecipients, RSendAsMessage::ESendAsRecipientTo);
iSendAsMessage.SetBodyTextL(aMessage);
 
iSendAsMessage.SendMessage(iStatus);
SetActive();
}
 
void CRSendAsSender::DoCancel()
{
iSendAsMessage.Cancel();
}
 
void CRSendAsSender::RunL()
{
iObserver.MessageSentL(iStatus.Int());
}

RSendAs_SMS.h

#include <e32base.h>
#include <F32FILE.H>
#include <BADESCA.H>
 
#include <rsendasmessage.h>
#include <rsendas.h>
#include <MTCLREG.H>
 
class MRSendSMSObserver
{
public:
virtual void MessageSentL(TInt aError) = 0;
};
 
class CRSendAsSender : public CActive
{
public:
static CRSendAsSender* NewL(MRSendSMSObserver& aObserver,const TDesC& aMessage,const TDesC& aRecipients);
~CRSendAsSender();
protected:
void DoCancel();
void RunL();
private:
CRSendAsSender(MRSendSMSObserver& aObserver);
void ConstructL(const TDesC& aMessage,const TDesC& aRecipients);
private:
MRSendSMSObserver& iObserver;
RSendAs iSendAs;
RSendAsMessage iSendAsMessage;
};

Related Links:

Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fMessageE5fhandlingE5finE5fJavaE5fPlatfromE2cE5fMicroE5fE45ditionE5fE28JavaE5fME45E29X qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqfntypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZmessagingQ qfnZtopicQUqfnTopicZsmsQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZtypeQUqfntypeZWikiContentQ qfnZuserE5ftagQSxmessagingX qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqfntypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ
User Rating: qfnZuserE5FratingQNx5E2E0000X