31
|
1 |
// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// $Workfile: IRCMTM.CPP $
|
|
15 |
// $Author: Stevep $
|
|
16 |
// $Revision: 9 $
|
|
17 |
// $Date: 23/01/02 14:21 $
|
|
18 |
//
|
|
19 |
//
|
|
20 |
|
|
21 |
//class include
|
|
22 |
#include "IRCMTM.H"
|
|
23 |
|
|
24 |
//system includes
|
|
25 |
#include <e32std.h>
|
|
26 |
#include <e32base.h>
|
|
27 |
//#include <eikenv.h>
|
|
28 |
#include <txtrich.h> // CRichText
|
|
29 |
#include <mtmuids.h> // KUidMtmQueryCanSendMsg
|
|
30 |
#include <msvreg.h> // CRegisteredMtmDll
|
|
31 |
#include <mtmdef.h> // KUidMtmQueryxxx & TMsvPartList flags
|
|
32 |
#include <msvuids.h> // KUidMsvMessageEntry
|
|
33 |
#include <irmtmcmds.h> // EIrMtmCmdSend
|
|
34 |
|
|
35 |
//user includes
|
|
36 |
#include <irheader.h>
|
|
37 |
#include "irmsgtypeuid.h" //KUidMsgTypeBt
|
|
38 |
#include "CIRCancelObserver.h"
|
|
39 |
#include <cobexsendoperation.h>
|
|
40 |
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
|
|
41 |
#include "msvconsts.h"
|
|
42 |
#include <mtmuidsdef.hrh>
|
|
43 |
#endif
|
|
44 |
|
|
45 |
EXPORT_C CIrClientMtm* CIrClientMtm::NewL(CRegisteredMtmDll& aRegisteredMtmDll, CMsvSession& aMsvSession)
|
|
46 |
/**
|
|
47 |
* Canonical NewL factory function.
|
|
48 |
*
|
|
49 |
* @param aRegisteredMtmDll Reference to registration data for MTM DLL.
|
|
50 |
* @param aMsvSession Reference to CMsvSession of the client requesting the object.
|
|
51 |
* @return Pointer to a new, constructed CIrClientMtm
|
|
52 |
* @leave Leaves if no memory is available.
|
|
53 |
*/
|
|
54 |
{
|
|
55 |
CIrClientMtm* self = new(ELeave) CIrClientMtm(aRegisteredMtmDll, aMsvSession);
|
|
56 |
CleanupStack::PushL(self);
|
|
57 |
self->ConstructL();
|
|
58 |
CleanupStack::Pop();
|
|
59 |
return self;
|
|
60 |
}
|
|
61 |
|
|
62 |
CIrClientMtm::CIrClientMtm(CRegisteredMtmDll& aRegisteredMtmDll, CMsvSession& aMsvSession)
|
|
63 |
: CObexClientMtm(aRegisteredMtmDll, aMsvSession, KUidMsgTypeIrUID)
|
|
64 |
/**
|
|
65 |
* Constructor
|
|
66 |
*
|
|
67 |
* @param aRegisteredMtmDll Registration data for MTM DLL.
|
|
68 |
* @param aMsvSession CMsvSession of the client requesting the object.
|
|
69 |
*/
|
|
70 |
{
|
|
71 |
}
|
|
72 |
|
|
73 |
void CIrClientMtm::InitialiseHeaderL()
|
|
74 |
/**
|
|
75 |
* Deletes the old header, then creates a new CIrHeader.
|
|
76 |
*
|
|
77 |
* @leave KErrXXX System-wide error codes if allocation fails
|
|
78 |
*/
|
|
79 |
{
|
|
80 |
delete iHeader;
|
|
81 |
iHeader = 0;
|
|
82 |
|
|
83 |
iHeader = CIrHeader::NewL();
|
|
84 |
}
|
|
85 |
|
|
86 |
CMsvOperation* CIrClientMtm::InvokeAsyncFunctionL(TInt aFunctionId,
|
|
87 |
const CMsvEntrySelection& aSelection,
|
|
88 |
TDes8& aParameter,
|
|
89 |
TRequestStatus& aCompletionStatus)
|
|
90 |
/**
|
|
91 |
* Starts an asynchronous messaging function as an active object. Only works for EIrcCmdSend.
|
|
92 |
*
|
|
93 |
* @param aFunctionId Identifier of the function to be invoked. Only supports EIrcCmdSend.
|
|
94 |
* @param aSelection Selection of message entries for the requested function to operate on.
|
|
95 |
* @param aParameter Buffer containing input and output parameters.
|
|
96 |
* @param aCompletionStatus Canonical TRequestStatus used for control of the active object.
|
|
97 |
* @return Pointer to a new asynchronously completing CMsvOperation. If failed, this is a completed operation with
|
|
98 |
* status set to the relevant error code.
|
|
99 |
* @leave KErrXXX System-wide error codes
|
|
100 |
* @leave KErrNotSupported if aFunctionId != EIrcCmdSend
|
|
101 |
*/
|
|
102 |
{
|
|
103 |
CMsvOperation* operation = NULL;
|
|
104 |
switch (aFunctionId)
|
|
105 |
{
|
|
106 |
case KMTMStandardFunctionsSendMessage:
|
|
107 |
{
|
|
108 |
CObexSendOperation* send = new(ELeave) CObexSendOperation(Session(), aCompletionStatus);
|
|
109 |
CleanupStack::PushL(send);
|
|
110 |
CIRCancelObserver* observer = CIRCancelObserver::NewL(send->iStatus, Session(), aSelection[0]);
|
|
111 |
CleanupStack::PushL(observer);
|
|
112 |
CMsvOperation* op = Session().TransferCommandL(aSelection, EIrcCmdSend, aParameter,
|
|
113 |
observer->Status());
|
|
114 |
observer->SetOperation(op);
|
|
115 |
send->Start(observer);
|
|
116 |
CleanupStack::Pop(2, send); // send, observer
|
|
117 |
operation = send;
|
|
118 |
break;
|
|
119 |
}
|
|
120 |
case EIrcCmdSend:
|
|
121 |
{
|
|
122 |
CIRCancelObserver* cancelObserver = CIRCancelObserver::NewL(aCompletionStatus, Session(), aSelection[0]);
|
|
123 |
CleanupStack::PushL(cancelObserver);
|
|
124 |
CMsvOperation* op = Session().TransferCommandL(aSelection, aFunctionId, aParameter,
|
|
125 |
cancelObserver->Status());
|
|
126 |
cancelObserver->SetOperation(op);
|
|
127 |
CleanupStack::Pop(cancelObserver);
|
|
128 |
operation = cancelObserver;
|
|
129 |
break;
|
|
130 |
}
|
|
131 |
default:
|
|
132 |
User::Leave(KErrNotSupported);
|
|
133 |
}
|
|
134 |
return operation; // ownership of operation is passed to caller
|
|
135 |
}
|