Hi, I'm Paul, but you can also call me Todd and I won't get upset.
Paul.Todd | 16 February, 2007 10:37
A number of people seem to have a problem using RSendAs to send a file via Bluetooth but its more or less the same as sending any other message.
To start, you need to get hold of the bluetooth MTM UID, its in "SendUiConsts.h"
Then its simply a case of:
void SendFileL(const TDesC& aFilename)
{
// 1. Open session
RSendAs session;
User::LeaveIfError(session.Connect());
CleanupClosePushL(session);
// 2. Create message
RSendAsMessage message;
message.CreateL(session, KSenduiMtmBtUid);
CleanupClosePushL(message);
// 3. Add attachment
TRequestStatus status;
message.AddAttachment(aFilename.FullName(), status);
User::WaitForRequest(status);
// 4. Send message
if (status.Int() == KErrNone)
{
CleanupStack::Pop(&message);
message.LaunchEditorAndCloseL();
}
else
CleanupStack::PopAndDestroy(&message);
CleanupStack::PopAndDestroy(&session);
}
krk_mohan | 16/02/2007, 13:39
Hi, I'm Paul, but you can also call me Todd and I won't get upset.
RDF Facets:
qfnZtopicQUqfnTopicZcppQ
qfnZtopicQUqfnTopicZmessagingQ
qfnZtopicQUqfnTopicZseriesE5f60Q
qfnZtypeQUqfnTypeZBlogContentQ
qfnZtypeQUqfnTypeZBlogE45ntryQ
qfnZtypeQUqfnTypeZCommunityContentQ
qfnZtypeQUqfnTypeZWebpageQ
qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX
Re: Send a file bluetooth
KevinD | 16/02/2007, 13:07
One thing I would say (and a general tip) - User::WaitForRequest() is nearly always a bad idea... Why?
* In an app, it will block re-drawing (adding the attachment usually completes quickly, but can take more time than you think if the file system is tied up). Not only does this look bad, you put yourself at risk of ViewSrv 11 panics.
* WaitForRequest() *doesn't work* with chains of active objects (and you have no way of telling if there is a chain of active objects underneath AddAttachment()). Prime examples where this can get you into hot water are the CTelephony methods (see http://forum.nokia.com/document/Forum_Nokia_Technical_Library/contents/FNTL/User_WaitForRequest()_with_ETel_3rd_Party_API_CTelephony.htm).
Avoid User::WaitForRequest() if at all possible..... If you are calling an asynchronous method, it was probably meant to be asynchronous.