messagingappbase/obexmtms/TObexMTM/SRC/CreateObexMessageState.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     1 // Copyright (c) 2002-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: CreateObexMessageState.cpp $
       
    15 // $Author: Simonk $
       
    16 // $Revision: 5 $
       
    17 // $Date: 31/01/02 10:07 $
       
    18 // 
       
    19 //
       
    20 
       
    21 
       
    22 #include "CreateObexMessageState.h"
       
    23 
       
    24 //TODO:- check that all these headers are required
       
    25 
       
    26 // System includes
       
    27 #include <btmsgtypeuid.h>   // KUidMsgTypeBt
       
    28 #include <btmtmcmds.h>      // TBtMtmAsyncCmds
       
    29 #include <irmsgtypeuid.h>   // KUidMsgTypeIr
       
    30 #include <irmtmcmds.h>      // TIrMtmAsyncCmds
       
    31 #include <msvuids.h>        // KUidMsvMessageEntry
       
    32 
       
    33 // User includes
       
    34 #include "obexharness.h"
       
    35 #include "obextestutils.h"
       
    36 
       
    37 //
       
    38 // CCreateObexMessageState
       
    39 //
       
    40 
       
    41 CCreateObexMessageState::CCreateObexMessageState(CObexClientTest& aClientTest) :
       
    42  iClientTest(aClientTest)
       
    43     {
       
    44     }
       
    45 
       
    46 void CCreateObexMessageState::StartL(TRequestStatus& aStatus)
       
    47     {
       
    48     // create the entry in the message store - note that these
       
    49 	// members have to be set up, or creating the entry panics
       
    50 
       
    51     CObexTestUtils& testUtils = iClientTest.ObexTestUtils();
       
    52     TMsvId service = testUtils.GetCurrentServiceId();
       
    53     TUid mtm = testUtils.CurrentObexMtm();
       
    54     (mtm == KUidMsgTypeBt) ? testUtils.InstantiateBTClientMtmL() : testUtils.InstantiateIRClientMtmL();
       
    55     CBaseMtm& client = testUtils.GetCurrentObexClientMtm();
       
    56     
       
    57 	//Create an entry
       
    58 	TMsvSelectionOrdering ordering;
       
    59 	CMsvEntry* entry = CMsvEntry::NewL(*testUtils.iMsvSession, KMsvRootIndexEntryId, ordering);
       
    60 	CleanupStack::PushL(entry);
       
    61 		
       
    62 	//Set the entry to the global outbox
       
    63 	entry->SetEntryL(KMsvGlobalOutBoxIndexEntryId);
       
    64     //NB - the first thing this function does is to put the argument on to the clean up stack.
       
    65 	client.SetCurrentEntryL(entry);
       
    66     CleanupStack::Pop();		//entry--since ownership is being passed
       
    67     
       
    68 	//At last we can create the new message
       
    69 	client.CreateMessageL(service);
       
    70     client.SaveMessageL();
       
    71     
       
    72     testUtils.SetEntryL(client.Entry().EntryId());
       
    73 
       
    74     TRequestStatus* status = &aStatus;
       
    75 	User::RequestComplete(status, KErrNone);
       
    76 
       
    77     }
       
    78