upnpsharing/upnpcontentserver/inc/upnpcontentserverclient.h
changeset 0 7f85d04be362
equal deleted inserted replaced
-1:000000000000 0:7f85d04be362
       
     1 /*
       
     2 * Copyright (c) 2006-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:      Header for content server client class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 #ifndef __UPNPCONTENTSERVERCLIENT_H__
       
    23 #define __UPNPCONTENTSERVERCLIENT_H__
       
    24 
       
    25 // INCLUDES
       
    26 #include <e32base.h>
       
    27 #include <badesca.h>  //CDesC8Array
       
    28 #include "upnpcontentserverdefs.h"
       
    29 
       
    30 // CONSTANTS
       
    31 // The maximum numbers of sharingrequests that can be currently received
       
    32 const TInt KContentServerMaxSharingReqs( 2 );
       
    33 const TUid KUpnpContentServerCat={0x20007564};
       
    34 enum TUpnpContentServerKeys {ESharingProgress};
       
    35 const TInt KMaxProgressLength( 50 );
       
    36 
       
    37 /**
       
    38  * Helper class to transfer progress information in one struct
       
    39  */
       
    40 class TUpnpProgressInfo
       
    41     {
       
    42 public:
       
    43 
       
    44     /**
       
    45      * Kind of operaiotn this information is related to
       
    46      * images&videos or playlists
       
    47      */
       
    48     UpnpContentServer::TUpnpMediaType iProgressKind;
       
    49 
       
    50     /**
       
    51      * Type of progress
       
    52      */
       
    53     enum TProgressType
       
    54         {
       
    55         ESharingProgress = 0, //sharing is ongoing for this kind of media
       
    56         EVisualStatus         //sharing is not ongoing
       
    57         };
       
    58     TProgressType iProgressType;
       
    59 
       
    60     /**
       
    61      * If iProgressType = ESharingProgress: the value 
       
    62      * of progress in percents 0-100.
       
    63      * If iProgressType = EVisualStatus: status of the selection 
       
    64      * ( UpnpContentServer::TUpnpSharingSelection )
       
    65      */
       
    66     TInt iProgress;
       
    67     };
       
    68 
       
    69 typedef RArray<TUpnpProgressInfo> TProgressInfos;
       
    70 
       
    71 /**
       
    72  * Helper class to contain all progress information
       
    73  */
       
    74 class TUpnpProgress
       
    75     {
       
    76 public:
       
    77 
       
    78     TUpnpProgressInfo iImageVideoProgress;
       
    79 
       
    80     TUpnpProgressInfo iMusicProgress;
       
    81 
       
    82     /**
       
    83      * Possible errorcode in sharing
       
    84      * 
       
    85      */
       
    86     TInt iError;
       
    87     };
       
    88 
       
    89 /**
       
    90  *  RUpnpContentServerClient class is used to create session and a connection
       
    91  *  to UpnpContentServer
       
    92  *
       
    93  *  @lib upnpcontentserverclient.lib
       
    94  *  @since S60 3.1
       
    95  */
       
    96 class RUpnpContentServerClient : public RSessionBase
       
    97     {
       
    98 
       
    99 public:
       
   100 
       
   101     /**
       
   102      * C++ default constructor.
       
   103      */
       
   104     IMPORT_C RUpnpContentServerClient();
       
   105 
       
   106     /**
       
   107      * Creates new session to Upnp Content Server
       
   108      * @since S60 3.1
       
   109      */
       
   110     IMPORT_C void OpenL();
       
   111 
       
   112     /**
       
   113      * Closes the connection with Upnp Content Server
       
   114      * @since S60 3.1
       
   115      */
       
   116     IMPORT_C void Close();
       
   117 
       
   118     /**
       
   119      * Starts the media server upload listener
       
   120      * Not supported
       
   121      * @since S60 3.1
       
   122      */
       
   123     IMPORT_C void StartUploadListenerL();
       
   124 
       
   125     /**
       
   126      * Stops the media server upload listener
       
   127      * Not supported
       
   128      * @since S60 3.1
       
   129      */
       
   130     IMPORT_C void StopUploadListenerL();
       
   131 
       
   132     /**
       
   133      * Gets the names of existed albums/playlists
       
   134      * @since S60 3.1
       
   135      * @param aType Type of media
       
   136      * @param aStatus TRequestStatus for async operation
       
   137      */
       
   138     IMPORT_C void GetSelectionContentL(
       
   139         UpnpContentServer::TUpnpMediaType aType,
       
   140         TRequestStatus& aStatus );
       
   141 
       
   142     /**
       
   143      * Ask the result of GetSelectionContentL call
       
   144      * Should be used after the GetSelectionContentL has completed.
       
   145      * @since S60 3.1
       
   146      * @param aIDArray Array to add selection items
       
   147      */
       
   148     IMPORT_C void GetSelectionContentResultL( CDesCArray& aIDArray );
       
   149 
       
   150     /**
       
   151      * Sends the selected indexes to server and starts sharing
       
   152      * @since S60 3.2
       
   153      * @param aType Type of media
       
   154      * @param aMarkedItems List of selected indexes
       
   155      * @param aStatus TRequestStatus for async operation.
       
   156      */
       
   157     IMPORT_C void ChangeSharedContentL(
       
   158         UpnpContentServer::TUpnpMediaType aType,
       
   159         const CArrayFix<TInt>& aMarkedItems,
       
   160         TRequestStatus& aStatus );
       
   161 
       
   162     /**
       
   163      * Refresh the shared content
       
   164      * @since S60 3.1
       
   165      * @param aType Type of media
       
   166      * @param aStatus TRequestStatus for async operation.
       
   167      */
       
   168     IMPORT_C void RefreshSharedContentL(
       
   169         UpnpContentServer::TUpnpMediaType aType,
       
   170         TRequestStatus& aStatus );
       
   171 
       
   172     /**
       
   173      * Gets the users previous selections as list of selected indexes
       
   174      * @since S60 3.1
       
   175      * @param aType Type of media
       
   176      * @param aStatus TRequestStatus for async operation.
       
   177      */
       
   178     IMPORT_C void GetSelectionIndexesL(
       
   179         UpnpContentServer::TUpnpMediaType aType,
       
   180         TRequestStatus& aStatus );
       
   181 
       
   182     /**
       
   183      * Ask the result of GetSelectionIndexesL call
       
   184      * @since S60 3.1
       
   185      * @param aMarkedItems Array to hold the items
       
   186      */
       
   187     IMPORT_C void GetSelectionIndexesResultL( 
       
   188         CArrayFix<TInt>& aMarkedItems );
       
   189 
       
   190     /**
       
   191      * Start connection monitor in content server
       
   192      * Handles stopping of media server in case of WLAN is lost
       
   193      * @since S60 3.1
       
   194      * @param aIapId Access point id
       
   195      * @param aStatus TRequestStatus for async operation
       
   196      */
       
   197     IMPORT_C void StartConnectionMonitorL( 
       
   198         TInt aIapId,
       
   199         TRequestStatus& aStatus );
       
   200 
       
   201     /**
       
   202      * Stop connection monitor in content server
       
   203      * @since S60 3.1
       
   204      * @param aStatus TRequestStatus for async operation
       
   205      */
       
   206     IMPORT_C void StopConnectionMonitorL( TRequestStatus& aStatus );
       
   207 
       
   208 private:
       
   209     /**
       
   210      * Free previous receive buffers and allocate new
       
   211      * @since S60 3.1
       
   212      * @param aSize The size of the buffer
       
   213      */
       
   214     void PrepareReceiveBuffersL( TInt aSize );
       
   215 
       
   216 private:
       
   217     /**
       
   218      * General buffer for sending data
       
   219      */
       
   220     TPtr8 iSendBufferPtr;
       
   221 
       
   222     /**
       
   223      * General buffer for sending data
       
   224      * Owned
       
   225      */
       
   226     CBufFlat* iSendBuffer;
       
   227 
       
   228     /**
       
   229      * General buffer for receiving data 
       
   230      */
       
   231     TPtr8 iReceiveBufferPtr;
       
   232 
       
   233     /**
       
   234      * General buffer for receiving data 
       
   235      * Owned
       
   236      */
       
   237     HBufC8* iReceiveBuffer;
       
   238 
       
   239     /**
       
   240      * Buffer for receiving content for sharing UI
       
   241      * separate buffer because of multiple async requests
       
   242      */
       
   243     TPtr8 iContentBufferPtr;
       
   244 
       
   245     /**
       
   246      * Buffer for receiving content for sharing UI
       
   247      * separate buffer because of multiple async requests
       
   248      * Owned
       
   249      */
       
   250     HBufC8* iContentBuffer;
       
   251 
       
   252     };
       
   253 
       
   254 #endif // __UPNPCONTENTSERVERCLIENT_H__
       
   255