messagingappbase/obexmtms/obexmtm/obexserver/source/obexServerMtm.cpp
changeset 0 72b543305e3a
equal deleted inserted replaced
-1:000000000000 0:72b543305e3a
       
     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: obexServerMtm.cpp $
       
    15 // $Author: Stevep $
       
    16 // $Revision: 8 $
       
    17 // $Date: 25/01/02 16:16 $
       
    18 // 
       
    19 //
       
    20 
       
    21 //class include
       
    22 #include <obexservermtm.h>
       
    23 //system includes
       
    24 #include <msventry.h>
       
    25 #include <msvids.h>
       
    26 //user includes
       
    27 #include <obexsendop.h>
       
    28 
       
    29 
       
    30 EXPORT_C CObexSrvMtm::CObexSrvMtm(CRegisteredMtmDll& aRegisteredMtmDll, CMsvServerEntry* aEntry):
       
    31 	CBaseServerMtm(aRegisteredMtmDll, aEntry)
       
    32 /**
       
    33  * Constructor
       
    34  *
       
    35  * @param aRegisterMtmDll	registration data for MTM dll
       
    36  * @param aEntry			Message Server entry to operate upon
       
    37  */
       
    38 	{
       
    39 	__DECLARE_NAME(_S("CObexSrvMtm"));
       
    40 	iSendOperation = 0;
       
    41 	}
       
    42 
       
    43 
       
    44 EXPORT_C void CObexSrvMtm::ConstructL()
       
    45 /**
       
    46  * Second phase constructor adds Obex server Mtm (this) to the active scheduler
       
    47  */	
       
    48 	{
       
    49 	User::LeaveIfError(iServerEntry->SetEntry(KMsvNullIndexEntryId));
       
    50 	CActiveScheduler::Add(this);
       
    51 	}
       
    52 
       
    53 EXPORT_C CObexSrvMtm::~CObexSrvMtm()
       
    54 /**
       
    55  * Destructor: Cancels active object (this)s
       
    56  */
       
    57 	{
       
    58 	Cancel();	//classes derived from CActive MUST call Cancel()
       
    59 	delete iEntry;
       
    60 	delete iSendOperation;
       
    61 	}
       
    62 
       
    63 
       
    64 
       
    65 EXPORT_C void CObexSrvMtm::SetInitialEntry(CMsvServerEntry* aEntry)
       
    66 /**
       
    67  * Sets message entry to be sent to aEntry
       
    68  *
       
    69  * @param aEntry message server entry (service)
       
    70  */
       
    71 	{
       
    72 	iEntry = aEntry;  // MUST copy as gain ownership - delete or will stay locked.
       
    73 	}
       
    74 
       
    75 
       
    76 
       
    77 
       
    78 
       
    79 
       
    80 EXPORT_C void CObexSrvMtm::CopyFromLocalL(const CMsvEntrySelection& /*aSelection*/,
       
    81 								 TMsvId /*aServiceId*/, /* Info for protocol....*/ 
       
    82 								 TRequestStatus& /*aStatus*/)
       
    83 /**
       
    84  * Copies a selection of entries from a local location to a remote location
       
    85  * N.B. Leaves as not supported
       
    86  *
       
    87  * @param aSelection The collection of message index entries for which the copy is required
       
    88  * @param aServiceId The entry ID of the service by which the entries should be transferred
       
    89  * @param aStatus Indicates operation completion
       
    90  */
       
    91 	{
       
    92 	User::Leave(KErrNotSupported);
       
    93 	return;
       
    94 	}
       
    95 
       
    96 
       
    97 EXPORT_C const TDesC8& CObexSrvMtm::Progress()
       
    98 /**
       
    99  * Obtains progress from the send operation and copies it into the iProgress member
       
   100  * 
       
   101  * @return a TBufPckg<TImSmtpProgress maintained by the instantiated CMsgImOutboxSend object
       
   102  */
       
   103 	{
       
   104 	if (iSendOperation)
       
   105 		{
       
   106 		//Get a local copy of the returned package buffer, which may be deleted at any moment...
       
   107 		TRAP_IGNORE(iProgress.Copy(iSendOperation->ProgressL()));
       
   108 		}
       
   109 
       
   110 	//
       
   111 	return iProgress;
       
   112 	}
       
   113 
       
   114 
       
   115 
       
   116 EXPORT_C void CObexSrvMtm::DoCancel()
       
   117 /**
       
   118  * Cancels the obex send operation
       
   119  */
       
   120 	{
       
   121 	iSendOperation->Cancel();   
       
   122 	User::RequestComplete(iReportStatus,KErrCancel);
       
   123 	}
       
   124 
       
   125 
       
   126 EXPORT_C void CObexSrvMtm::DoRunL()
       
   127 /**
       
   128  * 
       
   129  */
       
   130 	{
       
   131 	User::RequestComplete( iReportStatus, KErrNone );
       
   132 	}
       
   133 
       
   134 EXPORT_C void CObexSrvMtm::DoComplete(TInt /*aError*/)
       
   135 /**
       
   136  *
       
   137  */
       
   138 	{
       
   139 	}
       
   140 
       
   141 EXPORT_C TBool CObexSrvMtm::CommandExpected()
       
   142 /**
       
   143  * 
       
   144  */
       
   145 	{
       
   146 	return EFalse;
       
   147 	}
       
   148 
       
   149 //
       
   150 //  StartCommandL()
       
   151 //
       
   152 /*STP pure virtual in the base class.
       
   153 EXPORT_C void CObexSrvMtm::StartCommandL(CMsvEntrySelection& aSelection,
       
   154                                 TInt aCommand,
       
   155                                 const TDesC8& aParameter,
       
   156                                 TRequestStatus& aStatus)
       
   157 	{
       
   158 	iReport=&aStatus;
       
   159 	User::RequestComplete(iReport, KErrNone);   // iOutboxSend actually does nothing.
       
   160 	}
       
   161 */
       
   162 
       
   163 //*****************************************************************************
       
   164 //The rest of the commands are unsupported
       
   165 //*****************************************************************************
       
   166 
       
   167 // Messages are sent via the InvokeAsync command method on the client MTM.
       
   168 
       
   169 
       
   170 EXPORT_C void CObexSrvMtm::MoveFromLocalL(const CMsvEntrySelection& /*aSelection*/,
       
   171                                  TMsvId /*aServiceId*/,
       
   172                                  TRequestStatus& aStatus)
       
   173 /**
       
   174  * Function not supported
       
   175  */
       
   176 	{
       
   177 	iReportStatus=&aStatus;
       
   178 	User::RequestComplete(iReportStatus,KErrNotSupported);
       
   179 	}
       
   180 
       
   181 EXPORT_C void CObexSrvMtm::CopyToLocalL(const CMsvEntrySelection& /*aSelection*/,
       
   182                                TMsvId /*aDestination*/, 
       
   183                                TRequestStatus& aStatus)
       
   184 /**
       
   185  * Function not supported
       
   186  */
       
   187 	{
       
   188 	iReportStatus=&aStatus;
       
   189 	User::RequestComplete(iReportStatus,KErrNotSupported);
       
   190 	}
       
   191 
       
   192 EXPORT_C void CObexSrvMtm::MoveToLocalL(const CMsvEntrySelection& /*aSelection*/,
       
   193                                TMsvId /*aDestination*/,
       
   194                                TRequestStatus& aStatus)
       
   195 /**
       
   196  * Function not supported
       
   197  */
       
   198 	{
       
   199 	iReportStatus=&aStatus;
       
   200 	User::RequestComplete(iReportStatus,KErrNotSupported);
       
   201 	}
       
   202 
       
   203 EXPORT_C void CObexSrvMtm::CopyWithinServiceL(const CMsvEntrySelection& /*aSelection*/,
       
   204                                      TMsvId /*aDestination*/, TRequestStatus& aStatus)
       
   205 /**
       
   206  * Function not supported
       
   207  */
       
   208 	{
       
   209 	iReportStatus=&aStatus;
       
   210 	User::RequestComplete(iReportStatus,KErrNotSupported);
       
   211 	}
       
   212 
       
   213 EXPORT_C void CObexSrvMtm::MoveWithinServiceL(const CMsvEntrySelection& /*aSelection*/,
       
   214                                      TMsvId /*aDestination*/,
       
   215                                      TRequestStatus& aStatus)
       
   216 /**
       
   217  * Function not supported
       
   218  */
       
   219 	{
       
   220 	iReportStatus=&aStatus;
       
   221 	User::RequestComplete(iReportStatus,KErrNotSupported);
       
   222 	}
       
   223 
       
   224 EXPORT_C void CObexSrvMtm::DeleteL(const CMsvEntrySelection& /*aSelection*/, TRequestStatus& aStatus)
       
   225 /**
       
   226  * Function not supported
       
   227  */
       
   228 	{
       
   229 	iReportStatus=&aStatus;
       
   230 	User::RequestComplete(iReportStatus,KErrNotSupported);
       
   231 	}
       
   232 
       
   233 EXPORT_C void CObexSrvMtm::DeleteAllL(const CMsvEntrySelection& /*aSelection*/,
       
   234                              TRequestStatus& aStatus)
       
   235 /**
       
   236  * Function not supported
       
   237  */
       
   238 	{
       
   239 	iReportStatus=&aStatus;
       
   240 	User::RequestComplete(iReportStatus,KErrNotSupported);
       
   241 	}
       
   242 
       
   243 EXPORT_C void CObexSrvMtm::CreateL(TMsvEntry /*aNewEntry*/,
       
   244                           TRequestStatus& aStatus)
       
   245 /**
       
   246  * Function not supported
       
   247  */
       
   248 	{
       
   249 	iReportStatus=&aStatus;
       
   250 	User::RequestComplete(iReportStatus,KErrNotSupported);
       
   251 	}
       
   252 
       
   253 EXPORT_C void CObexSrvMtm::ChangeL(TMsvEntry /*aNewEntry*/,
       
   254                           TRequestStatus& aStatus)
       
   255 /**
       
   256  * Function not supported
       
   257  */
       
   258 	{
       
   259 	iReportStatus=&aStatus;
       
   260 	User::RequestComplete(iReportStatus,KErrNotSupported);
       
   261 	}
       
   262 
       
   263 
       
   264 
       
   265 
       
   266 
       
   267 
       
   268