This page was last modified 11:58, 24 March 2008.
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.
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 Discussions | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Automatic SMS Sending | dmyahya | General Symbian C++ | 3 | 2005-03-08 21:52 |
| Sending Vcards through sms/mms from python | federico2929 | Python | 0 | 2007-01-27 18:01 |
| sending sms | muhiadin70 | General Messaging | 2 | 2002-08-20 04:47 |
| Wireless Messaging API -NOkia SMS Api | erdnamit | Mobile Java General | 1 | 2003-05-14 13:55 |
| sms speed improving | minor666 | General Messaging | 3 | 2007-05-31 15:23 |
