Writing a Server MTM

This section explains the initial set up steps to be performed to write a Server MTM. It does not explain the implementation of all Server MTM functionality , however, you can refer the Server MTM example for detailed implementation steps.

Server MTM functions usually start an operation to perform a task asynchronously. The CBaseServerMtm Server MTM class passes its own iStatus 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 CActive . They are, however, usually designed to return progress in a similar way to a client-side operation.


  1. Derive a class from the CBaseServerMtm class.

  2. Register it using the CRegisteredMtmDll parameter.

  3. Create the CActive -based classes for performing the different operations that are required for your Messaging protocol.

Server MTM example

       //
//  CTextServerMtm: The Server-side MTM implementation
//
  
CTextServerMtm* CTextServerMtm::NewL(CRegisteredMtmDll& aRegisteredMtmDll, CMsvServerEntry* aInitialEntry)
// Exported factory function
    {
    CleanupStack::PushL(aInitialEntry);
    CTextServerMtm* self=new (ELeave) CTextServerMtm(aRegisteredMtmDll, aInitialEntry);
    CleanupStack::Pop();

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

CTextServerMtm::CTextServerMtm(CRegisteredMtmDll& aRegisteredMtmDll, CMsvServerEntry* aInitialEntry)
    :  CBaseServerMtm(aRegisteredMtmDll, aInitialEntry), 
        iCurrentOperation(ETxtOpIdle), 
        iServiceEntryId(aInitialEntry->Entry().Id())
    {
    }
      

For more details on implementing all UI MTM functions, see example code .