|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE task |
|
11 PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd"> |
|
12 <task id="GUID-5D5BF7E5-4105-572E-81B5-0E61E1AA443E" xml:lang="en"><title>Writing |
|
13 a Server MTM </title><abstract><p>This section explains the initial set up steps to be performed |
|
14 to write a Server MTM. It does not explain the implementation of all <xref href="GUID-963C0F50-A44A-518E-8DB0-42BEBEFD10A2.dita">Server MTM functionality</xref>, |
|
15 however, you can refer the <xref href="GUID-DB1D3045-2DC5-5C50-B430-526674369DC6.dita">Server |
|
16 MTM example</xref> for detailed implementation steps.</p></abstract><prolog><metadata><keywords/></metadata></prolog><taskbody> |
|
17 <context><p>Server MTM functions usually start an operation to perform a task |
|
18 asynchronously. The <xref href="GUID-D088273D-FAFE-30F6-8D0A-3A62D3DE62FD.dita"><apiname>CBaseServerMtm</apiname></xref> Server MTM class passes |
|
19 its own <xref href="GUID-6C0AA422-EA6F-3666-A973-DF6510B8F11C.dita"><apiname>iStatus</apiname></xref> member to the operation. Note that there |
|
20 is no base class for server-side operations, as there is on the client side. |
|
21 Server MTMs therefore implement their own operation classes derived directly |
|
22 from <xref href="GUID-067293BF-B28C-3CEC-92F4-1351A795EA7F.dita"><apiname>CActive</apiname></xref>. They are, however, usually designed to return |
|
23 progress in a similar way to a client-side operation. </p> </context> |
|
24 <steps id="GUID-C7A5F589-CDA2-5996-8FB4-08B7D1E175BA"> |
|
25 <step id="GUID-AB47DC3C-49D1-546E-A53E-E76074D606D4"><cmd/> |
|
26 <info>Derive a class from the <xref href="GUID-D088273D-FAFE-30F6-8D0A-3A62D3DE62FD.dita"><apiname>CBaseServerMtm</apiname></xref> class. </info> |
|
27 </step> |
|
28 <step id="GUID-D47A078C-ECDB-5035-8ED7-60A218B315AB"><cmd/> |
|
29 <info>Register it using the <xref href="GUID-0D5D7FAC-4F14-3046-92FB-873B8350FF4C.dita"><apiname>CRegisteredMtmDll</apiname></xref> parameter. </info> |
|
30 </step> |
|
31 <step id="GUID-BB5C73F0-E399-5430-AF36-C4711CD179A9"><cmd/> |
|
32 <info>Create the <xref href="GUID-067293BF-B28C-3CEC-92F4-1351A795EA7F.dita"><apiname>CActive</apiname></xref> -based classes for performing |
|
33 the different operations that are required for your Messaging protocol. </info> |
|
34 </step> |
|
35 </steps> |
|
36 <example><title>Server MTM example</title><codeblock xml:space="preserve">// |
|
37 // CTextServerMtm: The Server-side MTM implementation |
|
38 // |
|
39 |
|
40 CTextServerMtm* CTextServerMtm::NewL(CRegisteredMtmDll& aRegisteredMtmDll, CMsvServerEntry* aInitialEntry) |
|
41 // Exported factory function |
|
42 { |
|
43 CleanupStack::PushL(aInitialEntry); |
|
44 CTextServerMtm* self=new (ELeave) CTextServerMtm(aRegisteredMtmDll, aInitialEntry); |
|
45 CleanupStack::Pop(); |
|
46 |
|
47 CleanupStack::PushL(self); |
|
48 self->ConstructL(); |
|
49 CleanupStack::Pop(); |
|
50 return self; |
|
51 } |
|
52 |
|
53 CTextServerMtm::CTextServerMtm(CRegisteredMtmDll& aRegisteredMtmDll, CMsvServerEntry* aInitialEntry) |
|
54 : CBaseServerMtm(aRegisteredMtmDll, aInitialEntry), |
|
55 iCurrentOperation(ETxtOpIdle), |
|
56 iServiceEntryId(aInitialEntry->Entry().Id()) |
|
57 { |
|
58 }</codeblock> <p>For more details on implementing all UI |
|
59 MTM functions, see <xref href="GUID-DB1D3045-2DC5-5C50-B430-526674369DC6.dita">example |
|
60 code</xref>. </p> </example> |
|
61 </taskbody><related-links> |
|
62 <link href="GUID-59217FA7-3078-53CA-88B3-78D6FB788271.dita"><linktext>MTM overview</linktext> |
|
63 </link> |
|
64 <link href="GUID-E180D222-CC4F-5007-93FC-C339BBE708BC.dita"><linktext>Server MTM</linktext> |
|
65 </link> |
|
66 </related-links></task> |