upnpsharing/applicationengine/inc/upnpcontentshareao.h
branchIOP_Improvements
changeset 40 08b5eae9f9ff
parent 39 6369bfd1b60d
child 41 b4d83ea1d6e2
equal deleted inserted replaced
39:6369bfd1b60d 40:08b5eae9f9ff
     1 /*
       
     2 * Copyright (c) 2008 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:      file sharing engine class definition               
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #ifndef __UPNPCONTENTSHAREAO_H__
       
    23 #define __UPNPCONTENTSHAREAO_H__
       
    24 
       
    25 // INCLUDES
       
    26 #include <e32base.h>
       
    27 #include "upnpcontentserverclient.h"
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CUPnPFileSharingEngine;
       
    31 
       
    32 /**
       
    33  *  A class to send request to content server and get the responce.
       
    34  * *  @since S60 3.2
       
    35  */
       
    36 NONSHARABLE_CLASS( CUpnpContentShareAO ) : public CActive
       
    37     {
       
    38 
       
    39 private:
       
    40 
       
    41    /**
       
    42     * C++ constructor.
       
    43     * @since S60 3.2
       
    44     * @param aEngine the file sharing engine
       
    45     * @aContentServer the contentserver client
       
    46     */
       
    47     CUpnpContentShareAO( 
       
    48             CUPnPFileSharingEngine& aEngine,
       
    49             RUpnpContentServerClient& aContentServer );
       
    50 
       
    51     /**
       
    52      * Perform the second phase construction
       
    53      * @since S60 3.2
       
    54      */
       
    55     void ConstructL(); 
       
    56 
       
    57 public:
       
    58             
       
    59     /**
       
    60      * Two-phased constructor.
       
    61      * @since S60 3.2
       
    62      * @param aEngine the file sharing engine
       
    63      * @aContentServer the contentserver client
       
    64      */
       
    65      static CUpnpContentShareAO* NewL( 
       
    66              CUPnPFileSharingEngine& aEngine, 
       
    67              RUpnpContentServerClient& aContentServer );
       
    68 
       
    69     /**
       
    70      * Two-phased constructor.
       
    71      * @since S60 3.2
       
    72      * @param aEngine the file sharing engine
       
    73      * @aContentServer the contentserver client
       
    74      */
       
    75      static CUpnpContentShareAO* NewLC( 
       
    76              CUPnPFileSharingEngine& aEngine, 
       
    77              RUpnpContentServerClient& aContentServer );
       
    78 
       
    79    /**
       
    80     * C++ destructor.
       
    81     */
       
    82     virtual ~CUpnpContentShareAO();   
       
    83     
       
    84     /**
       
    85      * Sends the selected indexes to server and starts sharing
       
    86      * @since S60 3.2
       
    87      * @param aMarkedItems List of selected indexes
       
    88      * @param aType Type of selection
       
    89      */
       
    90     void ChangeSharedContentL(
       
    91         UpnpContentServer::TUpnpMediaType aType,
       
    92         const CArrayFix<TInt>& aMarkedItems );
       
    93 
       
    94     /**
       
    95      * Updates shared objects in mediaserver
       
    96      * @since S60 3.2
       
    97      * @param aType Type of media to refresh
       
    98      */
       
    99     void RefreshSharedContentL( 
       
   100         UpnpContentServer::TUpnpMediaType aType );
       
   101     
       
   102 protected:
       
   103 
       
   104    /**
       
   105     * Function is called when active request is ready
       
   106     * @since S60 3.2
       
   107     */
       
   108    void RunL();
       
   109 
       
   110    /**
       
   111     * Cancels active request
       
   112     * @since S60 3.2
       
   113     */
       
   114    void DoCancel();
       
   115 
       
   116    /**
       
   117     * Handles a leave occurring in the request completion event handler RunL()
       
   118     * @since S60 3.2
       
   119     */
       
   120    TInt RunError( TInt aError );
       
   121    
       
   122 private: // New functions
       
   123     
       
   124     /**
       
   125      * Removes queued objects by given index.
       
   126      * @since S60 5.1
       
   127      * @param aIndex The index of objects to be removed.
       
   128      */
       
   129     void RemoveQueuedObject( TInt aIndex );
       
   130     
       
   131     /**
       
   132      * Removes Queued objects by type.
       
   133      * @since S60 5.1
       
   134      * @param aType The type of objects to be removed.
       
   135      */
       
   136     void RemoveQueuedObjectByType( UpnpContentServer::TUpnpMediaType aType );
       
   137     
       
   138     /**
       
   139      * Appends given Queued objects.
       
   140      * @since S60 5.1
       
   141      * @param aType The type to appended
       
   142      * @param aSelections The selection array to be appended. Can be NULL.
       
   143      */
       
   144     void AppendQueuedObjectL( 
       
   145             UpnpContentServer::TUpnpMediaType aType, 
       
   146             CArrayFix<TInt>* aSelections );
       
   147 
       
   148 private: // data
       
   149 
       
   150     /**
       
   151      * File sharing engine
       
   152      */
       
   153     CUPnPFileSharingEngine& iEngine;
       
   154 
       
   155     /**
       
   156      * Content server session handle
       
   157      */
       
   158     RUpnpContentServerClient& iContentServer; 
       
   159 
       
   160     /**
       
   161      * Queued selection indexes
       
   162      */
       
   163     typedef CArrayFix<TInt> CSelections;
       
   164     RPointerArray<CSelections> iQueuedSelections;
       
   165 
       
   166     /**
       
   167      * Queued selection types
       
   168      */
       
   169     RArray<UpnpContentServer::TUpnpMediaType> iQueuedTypes;
       
   170 
       
   171     };
       
   172 
       
   173 #endif // __UPNPCONTENTSHAREAO_H__