examples/SFExamples/symbian_os_communications_programming_book_v2/chapter9/SendWorkBench/SendWorkbenchS60/src/Sender.cpp

00001 // 
00002 // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies).
00003 // All rights reserved.
00004 // This component and the accompanying materials are made available
00005 // under the terms of the License "Eclipse Public License v1.0"
00006 // which accompanies this distribution, and is available
00007 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
00008 // 
00009 // Initial Contributors:
00010 // Nokia Corporation - initial contribution.
00011 // 
00012 // Contributors:
00013 // 
00014 // Description:
00015 // 
00016 
00017 #include "Sender.h"
00018 #include <rsendas.h>
00019 #include <rsendasmessage.h>
00020 #include <csendasmessagetypes.h>
00021 #include <smut.h>
00022 
00023 
00024 void Sender::EditAndSendSMSL()
00025         {
00026         _LIT(KSMSBodyText, "Some body text to fill up space");
00027 
00028         RSendAs sendAs;
00029         User::LeaveIfError(sendAs.Connect());
00030         CleanupClosePushL(sendAs);
00031         
00032         RSendAsMessage sendAsMessage;
00033         sendAsMessage.CreateL(sendAs, KUidMsgTypeSMS);
00034         CleanupClosePushL(sendAsMessage);
00035 
00036         // prepare the message
00037         sendAsMessage.SetBodyTextL(KSMSBodyText);
00038 
00039         // send the message
00040         sendAsMessage.LaunchEditorAndCloseL();
00041         sendAs.Close(); 
00042         CleanupStack::PopAndDestroy(2,&sendAs);
00043         }
00044                 
00045 
00046 void Sender::SendAnSMSL()
00047         {// Use your own test phone number for the KSMSRecipient number
00048         _LIT(KSMSRecipient, "+919980506660");
00049         _LIT(KSMSBodyText, "Some body text to fill up space");
00050 
00051         RSendAs sendAs;
00052         User::LeaveIfError(sendAs.Connect());
00053         CleanupClosePushL(sendAs);
00054         
00055         RSendAsMessage sendAsMessage;
00056         sendAsMessage.CreateL(sendAs, KUidMsgTypeSMS);
00057         CleanupClosePushL(sendAsMessage);
00058 
00059         // prepare the message
00060         sendAsMessage.AddRecipientL(KSMSRecipient,RSendAsMessage::ESendAsRecipientTo);
00061         sendAsMessage.SetBodyTextL(KSMSBodyText);
00062         // send the message
00063         sendAsMessage.SendMessageAndCloseL();
00064         CleanupStack::PopAndDestroy(2,&sendAs);
00065         }       
00066 

Generated by  doxygen 1.6.2