ImagePrint/ImagePrintEngine/DeviceProtocols/upnpprotocolfw2/src/cupfilesharingactive.cpp
branchRCL_3
changeset 20 159fc2f68139
parent 17 26673e532f65
child 21 d59c248c9d36
equal deleted inserted replaced
17:26673e532f65 20:159fc2f68139
     1 /*
       
     2 * Copyright (c) 2002-2007 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Declares CUPFileSharingActive class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #include <upnpfilesharing.h>
       
    20 #include <upnpitem.h>
       
    21 #include <e32debug.h>
       
    22 
       
    23 #include "cupfilesharingactive.h"
       
    24 
       
    25 _LIT8( KRoot, "0" );
       
    26 
       
    27 
       
    28 // -----------------------------------------------------------------------------
       
    29 // CUPFileSharingActive::NewL
       
    30 // -----------------------------------------------------------------------------
       
    31 //
       
    32 CUPFileSharingActive* CUPFileSharingActive::NewL()
       
    33 	{
       
    34 	CUPFileSharingActive* self = new (ELeave) CUPFileSharingActive;
       
    35 	CleanupStack::PushL(self);
       
    36 	self->ConstructL();
       
    37 	CleanupStack::Pop();	// self
       
    38 	return self;
       
    39 	}
       
    40 
       
    41 // -----------------------------------------------------------------------------
       
    42 // CUPFileSharingActive::RunL
       
    43 // -----------------------------------------------------------------------------
       
    44 //
       
    45 void CUPFileSharingActive::RunL()
       
    46 	{
       
    47 	CActiveScheduler::Stop();
       
    48 	}
       
    49 
       
    50 // -----------------------------------------------------------------------------
       
    51 // CUPFileSharingActive::DoCancel
       
    52 // -----------------------------------------------------------------------------
       
    53 //	
       
    54 void CUPFileSharingActive::DoCancel()
       
    55 	{
       
    56 	; 
       
    57 	}
       
    58 	
       
    59 // -----------------------------------------------------------------------------
       
    60 // CUPFileSharingActive::RunError
       
    61 // -----------------------------------------------------------------------------
       
    62 //
       
    63 TInt CUPFileSharingActive::RunError( TInt aError )
       
    64 	{
       
    65 	return KErrNone;
       
    66 	}
       
    67 
       
    68 // -----------------------------------------------------------------------------
       
    69 // CUPFileSharingActive::ShareItemL
       
    70 // -----------------------------------------------------------------------------
       
    71 //	
       
    72 void CUPFileSharingActive::ShareItemL( CUpnpItem& aItem )
       
    73 	{
       
    74 	iStatus = KRequestPending;
       
    75 	iFileSharing->ShareItemL( KRoot, aItem, iStatus );
       
    76 	SetActive();
       
    77 	CActiveScheduler::Start();
       
    78 	User::LeaveIfError( iStatus.Int() );
       
    79 	}
       
    80 
       
    81 // -----------------------------------------------------------------------------
       
    82 // CUPFileSharingActive::UnShareItem
       
    83 // -----------------------------------------------------------------------------
       
    84 //	
       
    85 void CUPFileSharingActive::UnshareItemL( TInt aId )
       
    86 	{
       
    87 	iFileSharing->UnshareItemL( aId, iStatus );
       
    88 	SetActive();
       
    89 	CActiveScheduler::Start();
       
    90 	User::LeaveIfError( iStatus.Int() );  
       
    91 	}
       
    92 
       
    93 // -----------------------------------------------------------------------------
       
    94 // CUPFileSharingActive::GetSharedItemL
       
    95 // -----------------------------------------------------------------------------
       
    96 //
       
    97 void CUPFileSharingActive::GetSharedItemL( TInt aId, CUpnpItem& aItem )
       
    98 	{
       
    99 	iFileSharing->GetSharedItemL( aId, aItem , iStatus );
       
   100 	SetActive();
       
   101 	CActiveScheduler::Start();
       
   102 	User::LeaveIfError(iStatus.Int());
       
   103 	}
       
   104 
       
   105 // Constructors and destructor
       
   106 // -----------------------------------------------------------------------------
       
   107 // CUPFileSharingActive::CUPFileSharingActive
       
   108 // -----------------------------------------------------------------------------
       
   109 //
       
   110 CUPFileSharingActive::CUPFileSharingActive():CActive( EPriorityNormal )
       
   111 	{
       
   112 	CActiveScheduler::Add( this );
       
   113 	}
       
   114 
       
   115 // -----------------------------------------------------------------------------
       
   116 // CUPFileSharingActive::ConstructL
       
   117 // -----------------------------------------------------------------------------
       
   118 //
       
   119 void CUPFileSharingActive::ConstructL()
       
   120 	{
       
   121 	iFileSharing = CUpnpFileSharing::NewL();
       
   122 	}
       
   123 
       
   124 // -----------------------------------------------------------------------------
       
   125 // CUPFileSharingActive::~CUPFileSharingActive
       
   126 // -----------------------------------------------------------------------------
       
   127 //
       
   128 CUPFileSharingActive::~CUPFileSharingActive()
       
   129 	{
       
   130 	Cancel();
       
   131 	delete iFileSharing;
       
   132 	}
       
   133 
       
   134 //  End of File