Symbian3/SDK/Source/GUID-5D5BF7E5-4105-572E-81B5-0E61E1AA443E.dita
author Dominic Pinkman <dominic.pinkman@nokia.com>
Tue, 20 Jul 2010 12:00:49 +0100
changeset 13 48780e181b38
parent 0 89d6a7a84779
permissions -rw-r--r--
Week 28 contribution of SDK documentation content. See release notes for details. Fixes bugs Bug 1897 and Bug 1522.

<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
<!-- This component and the accompanying materials are made available under the terms of the License 
"Eclipse Public License v1.0" which accompanies this distribution, 
and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
<!-- Initial Contributors:
    Nokia Corporation - initial contribution.
Contributors: 
-->
<!DOCTYPE task
  PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
<task id="GUID-5D5BF7E5-4105-572E-81B5-0E61E1AA443E" xml:lang="en"><title>Writing
a Server MTM </title><abstract><p>This section explains the initial set up steps to be performed
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>,
however, you can refer the <xref href="GUID-DB1D3045-2DC5-5C50-B430-526674369DC6.dita">Server
MTM example</xref> for detailed implementation steps.</p></abstract><prolog><metadata><keywords/></metadata></prolog><taskbody>
<context><p>Server MTM functions usually start an operation to perform a task
asynchronously. The <xref href="GUID-D088273D-FAFE-30F6-8D0A-3A62D3DE62FD.dita"><apiname>CBaseServerMtm</apiname></xref> Server MTM class passes
its own <xref href="GUID-6C0AA422-EA6F-3666-A973-DF6510B8F11C.dita"><apiname>iStatus</apiname></xref> member to the operation. Note that there
is no base class for server-side operations, as there is on the client side.
Server MTMs therefore implement their own operation classes derived directly
from <xref href="GUID-067293BF-B28C-3CEC-92F4-1351A795EA7F.dita"><apiname>CActive</apiname></xref>. They are, however, usually designed to return
progress in a similar way to a client-side operation. </p> </context>
<steps id="GUID-C7A5F589-CDA2-5996-8FB4-08B7D1E175BA">
<step id="GUID-AB47DC3C-49D1-546E-A53E-E76074D606D4"><cmd/>
<info>Derive a class from the <xref href="GUID-D088273D-FAFE-30F6-8D0A-3A62D3DE62FD.dita"><apiname>CBaseServerMtm</apiname></xref> class. </info>
</step>
<step id="GUID-D47A078C-ECDB-5035-8ED7-60A218B315AB"><cmd/>
<info>Register it using the <xref href="GUID-0D5D7FAC-4F14-3046-92FB-873B8350FF4C.dita"><apiname>CRegisteredMtmDll</apiname></xref> parameter. </info>
</step>
<step id="GUID-BB5C73F0-E399-5430-AF36-C4711CD179A9"><cmd/>
<info>Create the <xref href="GUID-067293BF-B28C-3CEC-92F4-1351A795EA7F.dita"><apiname>CActive</apiname></xref> -based classes for performing
the different operations that are required for your Messaging protocol. </info>
</step>
</steps>
<example><title>Server MTM example</title><codeblock xml:space="preserve">//
//  CTextServerMtm: The Server-side MTM implementation
//
  
CTextServerMtm* CTextServerMtm::NewL(CRegisteredMtmDll&amp; aRegisteredMtmDll, CMsvServerEntry* aInitialEntry)
// Exported factory function
    {
    CleanupStack::PushL(aInitialEntry);
    CTextServerMtm* self=new (ELeave) CTextServerMtm(aRegisteredMtmDll, aInitialEntry);
    CleanupStack::Pop();

    CleanupStack::PushL(self);
    self-&gt;ConstructL();
    CleanupStack::Pop();
    return self;
    }

CTextServerMtm::CTextServerMtm(CRegisteredMtmDll&amp; aRegisteredMtmDll, CMsvServerEntry* aInitialEntry)
    :  CBaseServerMtm(aRegisteredMtmDll, aInitialEntry), 
        iCurrentOperation(ETxtOpIdle), 
        iServiceEntryId(aInitialEntry-&gt;Entry().Id())
    {
    }</codeblock> <p>For more details on implementing all UI
MTM functions, see <xref href="GUID-DB1D3045-2DC5-5C50-B430-526674369DC6.dita">example
code</xref>. </p> </example>
</taskbody><related-links>
<link href="GUID-59217FA7-3078-53CA-88B3-78D6FB788271.dita"><linktext>MTM overview</linktext>
</link>
<link href="GUID-E180D222-CC4F-5007-93FC-C339BBE708BC.dita"><linktext>Server MTM</linktext>
</link>
</related-links></task>