upnpavcontroller/upnpavcontrollerserver/inc/upnpbrowsingsession.h
changeset 0 7f85d04be362
child 38 5360b7ddc251
equal deleted inserted replaced
-1:000000000000 0:7f85d04be362
       
     1 /*
       
     2 * Copyright (c) 2006 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:      implementation for session towards a media server
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 #ifndef C_UPNPBROWSINGSESSION_H
       
    25 #define C_UPNPBROWSINGSESSION_H
       
    26 
       
    27 // INCLUDE FILES
       
    28 #include <e32base.h>
       
    29 #include "upnpavcontroller.h"
       
    30 #include <upnpavcontrolpointobserver.h>
       
    31 #include <upnpmediaserverobserver.h>
       
    32 #include "upnpavbrowsingsession.h"
       
    33 
       
    34 
       
    35 // FORWARD DECLARATIONS
       
    36 class CUpnpItem;
       
    37 class CUpnpObject;
       
    38 class CUpnpAVRequest;
       
    39 class CUpnpAVBrowseRequest;
       
    40 class CUPnPFileSharingActive;
       
    41 class CUpnpMediaServerNotifier;
       
    42 class RUpnpMediaServerClient;
       
    43 class CUpnpAVDeviceExtended;
       
    44 class CUpnpMediaServerSettings;
       
    45 class CRepository;
       
    46 class CUpnpAVControllerServer;
       
    47 /**
       
    48  * Implements server side browsing session functionality. Implements
       
    49  * browsing, searching, copying etc.  
       
    50  *
       
    51  * @since S60 v3.1
       
    52  */
       
    53 class CUPnPBrowsingSession :    public CBase,
       
    54                                 public MUpnpAVControlPointObserver,
       
    55                                 public MUpnpMediaServerObserver
       
    56     {
       
    57 
       
    58 private:
       
    59 
       
    60     /**
       
    61      * Defines the internal state of browsing session
       
    62      */
       
    63     enum TInternalBrowseState
       
    64         {
       
    65         ENone,
       
    66         EBrowse,
       
    67         EDestroyObject,
       
    68         ECopyLocal,
       
    69         ECreateContainer,
       
    70         ECopyToPhone
       
    71         };
       
    72 
       
    73     enum TInternalCopyState
       
    74         {
       
    75         EIdle,
       
    76         EObjectCreated,
       
    77         ECopying
       
    78         };
       
    79 
       
    80 public:
       
    81 
       
    82     /**
       
    83      * Static 1st phase constructor
       
    84      *
       
    85      * @param aControlPoint AV Control Point reference
       
    86      * @param aClient S60 Media Server session reference
       
    87      * @param aDispatcher observer callback dispatcher reference
       
    88      * @param aSessionId session id
       
    89      * @param aUuid device Uuid
       
    90      */
       
    91     static CUPnPBrowsingSession* NewL
       
    92         (
       
    93         RUpnpMediaServerClient& aClient,
       
    94         CUpnpAVControllerServer& aServer,
       
    95         TInt aSessionId,   
       
    96         const TDesC8& aUuid
       
    97         );
       
    98     
       
    99     /**
       
   100      * Destructor
       
   101      */
       
   102     virtual ~CUPnPBrowsingSession();
       
   103     
       
   104 private:
       
   105 
       
   106     /**
       
   107      * Private constructor
       
   108      *
       
   109      * @param aControlPoint AV Control Point reference
       
   110      * @param aClient S60 Media Server session reference
       
   111      * @param aDispatcher observer callback dispatcher reference
       
   112      * @param aSessionId session id
       
   113      */
       
   114     CUPnPBrowsingSession
       
   115         (
       
   116         RUpnpMediaServerClient& aClient,
       
   117         CUpnpAVControllerServer& aServer,
       
   118         TInt aSessionId
       
   119         );    
       
   120     
       
   121     /**
       
   122      * 2ns phase constructor
       
   123      */
       
   124     void ConstructL( const TDesC8& aUuid );
       
   125 
       
   126 protected: // From MUpnpAVControlPointObserver
       
   127 
       
   128     /**
       
   129      * Observer callback for rendering control Set Volume.
       
   130      * @since Series 60 2.6
       
   131      * @param aUuid Source device UUID. 
       
   132      * @param aSessionId 
       
   133      * @param aErr UPnP error code.
       
   134      * @param aInstance rendering instance.
       
   135      * @param aChannel audio channel.
       
   136      * @param aDesiredVolume 
       
   137      */
       
   138     void RcSetVolumeResponse(
       
   139         const TDesC8& aUuid,
       
   140         TInt aSessionId,
       
   141         TInt aErr, 
       
   142         const TDesC8& aInstance, 
       
   143         const TDesC8& aChannel, 
       
   144         const TDesC8& aDesiredVolume);
       
   145         
       
   146     /**
       
   147      * Observer callback for rendering control Get Volume.
       
   148      * @since Series 60 2.6
       
   149      * @param aUuid Source device UUID. 
       
   150      * @param aSessionId 
       
   151      * @param aErr UPnP error code.
       
   152      * @param aInstance rendering instance.
       
   153      * @param aChannel audio channel.
       
   154      * @param aCurrentVolume 
       
   155      */
       
   156     void RcVolumeResponse(
       
   157         const TDesC8& aUuid,
       
   158         TInt aSessionId,
       
   159         TInt aErr, 
       
   160         const TDesC8& aInstance, 
       
   161         const TDesC8& aChannel, 
       
   162         const TDesC8& aCurrentVolume);
       
   163          
       
   164     /**
       
   165      * Observer callback for rendering control Set Mute.
       
   166      * @since Series 60 2.6
       
   167      * @param aUuid Source device UUID. 
       
   168      * @param aSessionId 
       
   169      * @param aErr UPnP error code.
       
   170      * @param aInstance rendering instance.
       
   171      * @param aChannel audio channel.
       
   172      * @param aDesiredMute 
       
   173      */
       
   174     void RcSetMuteResponse(
       
   175         const TDesC8& aUuid,
       
   176         TInt aSessionId,
       
   177         TInt aErr, 
       
   178         const TDesC8& aInstance, 
       
   179         const TDesC8& aChannel, 
       
   180         const TDesC8& aDesiredMute);
       
   181         
       
   182     /**
       
   183      * Observer callback for rendering control Get Mute.
       
   184      * @since Series 60 2.6
       
   185      * @param aUuid Source device UUID. 
       
   186      * @param aSessionId 
       
   187      * @param aErr UPnP error code.
       
   188      * @param aInstance rendering instance.
       
   189      * @param aChannel audio channel.
       
   190      * @param aCurrentMute 
       
   191      */
       
   192     void RcMuteResponse(
       
   193         const TDesC8& aUuid,
       
   194         TInt aSessionId,
       
   195         TInt aErr, 
       
   196         const TDesC8& aInstance, 
       
   197         const TDesC8& aChannel, 
       
   198         const TDesC8& aCurrentMute); 
       
   199 
       
   200 
       
   201     /**
       
   202      * Observer callback for rendering control AV set transport uri.
       
   203      * @since Series 60 2.6
       
   204      * @param aUuid Source device UUID. 
       
   205      * @param aSessionId 
       
   206      * @param aErr UPnP error code.
       
   207      * @param aInstance rendering instance.
       
   208      * @param aCurrentUri Current transport URI.
       
   209      * @param Current transport URI Metadata. 
       
   210      */
       
   211     void AvtSetTransportUriResponse(
       
   212         const TDesC8& aUuid,
       
   213         TInt aSessionId,
       
   214         TInt aErr,
       
   215         const TDesC8& aInstanceId,
       
   216         const TDesC8& aCurrentUri,
       
   217         const TDesC8& aCurrentUriMetaData);
       
   218         
       
   219     /**
       
   220      * Observer callback for rendering control AV set next transport uri.
       
   221      * @since Series 60 2.6
       
   222      * @param aUuid Source device UUID. 
       
   223      * @param aSessionId 
       
   224      * @param aErr UPnP error code.
       
   225      * @param aInstance rendering instance.
       
   226      * @param aCurrentUri Current transport URI.
       
   227      * @param Current transport URI Metadata. 
       
   228      */
       
   229     virtual void AvtSetNextTransportUriResponse(
       
   230         const TDesC8& aUuid,
       
   231         TInt aSessionId,
       
   232         TInt aErr,
       
   233         const TDesC8& aInstanceId,
       
   234         const TDesC8& aNextUri,
       
   235         const TDesC8& aNextUriMetaData);
       
   236         
       
   237     /**
       
   238      * Observer callback for rendering control AV get media info response.
       
   239      * @since Series 60 2.6
       
   240      * @param aUuid Source device UUID. 
       
   241      * @param aSessionId 
       
   242      * @param aErr UPnP error code.
       
   243      * @param aInstance rendering instance.
       
   244      * @param aNrTracks Number of tracks.
       
   245      * @param aMediaDuration 
       
   246      * @param aCurrentUri Current transport URI.
       
   247      * @param aCurrentUriMetaData Metadata of current trransport uri. 
       
   248      * @param aNextUri Next transport URI.
       
   249      * @param aNextUriMetaData Metadata of next trransport uri.
       
   250      * @param aPlayMedium
       
   251      * @param aRecordMedium
       
   252      * @param aWriteStatus
       
   253      */
       
   254     void AvtMediaInfoResponse(
       
   255         const TDesC8& aUuid,
       
   256         TInt aSessionId,
       
   257         TInt aErr,
       
   258         const TDesC8& aInstanceId,
       
   259         const TDesC8& aNrTracks,
       
   260         const TDesC8& aMediaDuration,
       
   261         const TDesC8& aCurrentUri,
       
   262         const TDesC8& aCurrentUriMetaData,
       
   263         const TDesC8& aNextUri,
       
   264         const TDesC8& aNextUriMetaData,
       
   265         const TDesC8& aPlayMedium,
       
   266         const TDesC8& aRecordMedium,
       
   267         const TDesC8& aWriteStatus);
       
   268         
       
   269     /**
       
   270      * Observer callback for rendering control AV get transport info response.
       
   271      * @since Series 60 2.6
       
   272      * @param aUuid Source device UUID. 
       
   273      * @param aSessionId
       
   274      * @param aErr UPnP error code.
       
   275      * @param aInstance rendering instance.
       
   276      * @param aCurrenTransportState
       
   277      * @param aCurrentTransportStatus
       
   278      * @param aCurrentUri aCurrentSpeed
       
   279      */
       
   280     void AvtGetTransportInfoResponse(
       
   281         const TDesC8& aUuid,
       
   282         TInt aSessionId,
       
   283         TInt aErr,
       
   284         const TDesC8& aInstanceId,
       
   285         const TDesC8& aCurrenTransportState,
       
   286         const TDesC8& aCurrentTransportStatus,
       
   287         const TDesC8& aCurrentSpeed);
       
   288         
       
   289     /**
       
   290      * Observer callback for rendering control AV get position info response.
       
   291      * @since Series 60 2.6
       
   292      * @param aUuid Source device UUID. 
       
   293      * @param aSessionId 
       
   294      * @param aErr UPnP error code.
       
   295      * @param aTrack rendering instance.
       
   296      * @param aTrackDuration 
       
   297      * @param aTrackMetaData
       
   298      * @param aTrackURI
       
   299      * @param aRelTime
       
   300      * @param aAbsTime
       
   301      * @param aRelCount
       
   302      * @param aAbsCount
       
   303      */
       
   304     void AvtPositionInfoResponse(
       
   305         const TDesC8& aUuid,
       
   306         TInt aSessionId,
       
   307         TInt aErr,
       
   308         const TDesC8& aInstanceId,
       
   309         const TDesC8& aTrack,
       
   310         const TDesC8& aTrackDuration,
       
   311         const TDesC8& aTrackMetaData,
       
   312         const TDesC8& aTrackURI,
       
   313         const TDesC8& aRelTime,
       
   314         const TDesC8& aAbsTime,
       
   315         const TDesC8& aRelCount,
       
   316         const TDesC8& aAbsCount);
       
   317         
       
   318     /**
       
   319      * Observer callback for rendering control AV get device
       
   320      * capabilities response.
       
   321      * @since Series 60 2.6
       
   322      * @param aUuid Source device UUID. 
       
   323      * @param aSessionId 
       
   324      * @param aErr UPnP error code.
       
   325      * @param aPlayMedia
       
   326      * @param aRecMedia 
       
   327      * @param aRecQualityModes
       
   328      */
       
   329     void AvtDeviceCapabilitiesResponse(
       
   330         const TDesC8& aUuid,
       
   331         TInt aSessionId,
       
   332         TInt aErr,
       
   333         const TDesC8& aInstanceId,
       
   334         const TDesC8& aPlayMedia,
       
   335         const TDesC8& aRecMedia,
       
   336         const TDesC8& aRecQualityMode);
       
   337         
       
   338     /**
       
   339      * Observer callback for rendering control AV get transport
       
   340      * settings response.
       
   341      * @since Series 60 2.6
       
   342      * @param aUuid Source device UUID. 
       
   343      * @param aSessionId
       
   344      * @param aInstanceId
       
   345      * @param aErr UPnP error code.        
       
   346      * @param aPlayMode
       
   347      * @param aRecQualityMode
       
   348      */
       
   349     void AvtTransportSettingsResponse(
       
   350         const TDesC8& aUuid,
       
   351         TInt aSessionId,
       
   352         TInt aErr,
       
   353         const TDesC8& aInstanceId,
       
   354         const TDesC8& aPlayMode,
       
   355         const TDesC8& aRecQualityMode);
       
   356         
       
   357     /**
       
   358      * Observer callback for rendering control AV Stop response.
       
   359      * @since Series 60 2.6
       
   360      * @param aUuid Source device UUID. 
       
   361      * @param aSessionId 
       
   362      * @param aErr UPnP error code.
       
   363      */
       
   364     void AvtStopResponse(
       
   365         const TDesC8& aUuid,
       
   366         TInt aSessionId,
       
   367         TInt aErr,
       
   368         const TDesC8& aInstanceId);
       
   369         
       
   370     /**
       
   371      * Observer callback for rendering control AV Play response.
       
   372      * @since Series 60 2.6
       
   373      * @param aUuid Source device UUID. 
       
   374      * @param aSessionId 
       
   375      * @param aErr UPnP error code.
       
   376      * @param aSpeed
       
   377      */
       
   378     void AvtPlayResponse(
       
   379         const TDesC8& aUuid,
       
   380         TInt aSessionId,
       
   381         TInt aErr,
       
   382         const TDesC8& aInstanceId,
       
   383         const TDesC8& aSpeed);
       
   384     
       
   385     /**
       
   386      * Observer callback for rendering control AV Pause response.
       
   387      * @since Series 60 2.6
       
   388      * @param aUuid Source device UUID. 
       
   389      * @param aSessionId 
       
   390      * @param aErr UPnP error code.
       
   391      */
       
   392     void AvtPauseResponse(
       
   393         const TDesC8& aUuid,
       
   394         TInt aSessionId,
       
   395         TInt aErr,
       
   396         const TDesC8& aInstanceId);
       
   397         
       
   398     /**
       
   399      * Observer callback for rendering control AV Record response.
       
   400      * @since Series 60 2.6
       
   401      * @param aUuid Source device UUID. 
       
   402      * @param aSessionId 
       
   403      * @param aErr UPnP error code.
       
   404      */
       
   405     void AvtRecordResponse(
       
   406         const TDesC8& aUuid,
       
   407         TInt aSessionId,
       
   408         TInt aErr,
       
   409         const TDesC8& aInstanceId);
       
   410         
       
   411     /**
       
   412      * Observer callback for rendering control AV Seek response.
       
   413      * @since Series 60 2.6
       
   414      * @param aSessionId 
       
   415      * @param aErr UPnP error code.
       
   416      * @param aUnit
       
   417      * @param aTarget
       
   418      */
       
   419     void AvtSeekResponse(
       
   420         const TDesC8& aUuid,
       
   421         TInt aSessionId,
       
   422         TInt aErr,
       
   423         const TDesC8& aInstanceId,
       
   424         const TDesC8& aUnit,
       
   425         const TDesC8& aTarget);
       
   426         
       
   427     /**
       
   428      * Observer callback for rendering control AV Next response.
       
   429      * @since Series 60 2.6
       
   430      * @param aUuid Source device UUID. 
       
   431      * @param aSessionId 
       
   432      * @param aErr UPnP error code.
       
   433      */
       
   434     void AvtNextResponse(
       
   435         const TDesC8& aUuid,
       
   436         TInt aSessionId,
       
   437         TInt aErr,
       
   438         const TDesC8& aInstanceId);
       
   439         
       
   440     /**
       
   441      * Observer callback for rendering control AV Previous response.
       
   442      * @since Series 60 2.6
       
   443      * @param aUuid Source device UUID. 
       
   444      * @param aSessionId 
       
   445      * @param aErr UPnP error code.
       
   446      */
       
   447     void AvtPreviousResponse(
       
   448         const TDesC8& aUuid,
       
   449         TInt aSessionId,
       
   450         TInt aErr,
       
   451         const TDesC8& aInstanceId);
       
   452     
       
   453     /**
       
   454      * Observer callback for rendering control AV setplay mode response.
       
   455      * @since Series 60 2.6
       
   456      * @param aUuid Source device UUID. 
       
   457      * @param aSessionId 
       
   458      * @param aErr UPnP error code.
       
   459      * @param aNewPlayMode
       
   460      */
       
   461     void AvtSetPlayModeResponse(
       
   462         const TDesC8& aUuid,
       
   463         TInt aSessionId,
       
   464         TInt aErr,
       
   465         const TDesC8& aInstanceId,
       
   466         const TDesC8& aNewPlayMode);
       
   467         
       
   468     /**
       
   469      * Observer callback for rendering control AV set record qualityresponse.
       
   470      * @since Series 60 2.6
       
   471      * @param aUuid Source device UUID. 
       
   472      * @param aSessionId 
       
   473      * @param aErr UPnP error code.
       
   474      * @param aNewRecordQuality
       
   475      */
       
   476     void AvtSetRecordModeResponse(
       
   477         const TDesC8& aUuid,
       
   478         TInt aSessionId,
       
   479         TInt aErr,
       
   480         const TDesC8& aInstanceId,
       
   481         const TDesC8& aNewRecordQuality);
       
   482         
       
   483     /**
       
   484      * Observer callback for Content Directory GetSearchCapabilities function.
       
   485      * @since Series 60 2.6
       
   486      * @param aUuid Source device UUID. 
       
   487      * @param aSessionId 
       
   488      * @param aErr UPnP error code.
       
   489      * @param aSearchCaps
       
   490      */
       
   491     void CdsSearchCapabilitiesResponse(
       
   492         const TDesC8& aUuid,
       
   493         TInt aSessionId,
       
   494         TInt aErr,
       
   495         const TDesC8& aSearchCaps);
       
   496         
       
   497     /**
       
   498      * Observer callback for Content Directory GetSortCapabilities function.
       
   499      * @since Series 60 2.6
       
   500      * @param aUuid Source device UUID. 
       
   501      * @param aSessionId 
       
   502      * @param aErr UPnP error code.
       
   503      * @param aSortCaps
       
   504      */
       
   505     void CdsSortCapabilitiesResponse(
       
   506         const TDesC8& aUuid,
       
   507         TInt aSessionId,
       
   508         TInt aErr,
       
   509         const TDesC8& aSortCaps);
       
   510 
       
   511     /**
       
   512      * Observer callback for Content Directory GetSystemUpdateID function.
       
   513      * @since Series 60 2.6
       
   514      * @param aSessionId 
       
   515      * @param aErr UPnP error code.
       
   516      * @param aSystemUpdateId
       
   517      */
       
   518     void CdsSystemUpdateIdResponse(
       
   519         const TDesC8& aUuid,
       
   520         TInt aSessionId,
       
   521         TInt aErr,
       
   522         TInt aSystemUpdateId);
       
   523     /**
       
   524     * Observer callback for Content Directory Browse function.
       
   525     * @since Series 60 2.6
       
   526     * @param aUuid Source device UUID. 
       
   527     * @param aSessionId 
       
   528     * @param aErr UPnP error code.
       
   529     * @param aObjectID
       
   530     * @param aBrowseFlag
       
   531     * @param aFilter
       
   532     * @param aIndex
       
   533     * @param arequest
       
   534     * @param aSortCriteria
       
   535     * @param aResult
       
   536     * @param aReturned
       
   537     * @param aMatches
       
   538     * @param aUpdateID
       
   539     */
       
   540     
       
   541     void CdsBrowseResponse(
       
   542         const TDesC8& aUuid,
       
   543         TInt aSessionId,
       
   544         TInt aErr,
       
   545         const TDesC8& aObjectID,
       
   546         const TDesC8&  aBrowseFlag,
       
   547         const TDesC8&  aFilter,
       
   548         TInt aIndex,
       
   549         TInt aRequest,
       
   550         const TDesC8&  aSortCriteria,
       
   551         const TDesC8&  aResult,
       
   552         TInt aReturned,
       
   553         TInt aMatches,
       
   554         const TDesC8&  aUpdateID);
       
   555         
       
   556     /**
       
   557      * Observer callback for Content Directory Search function.
       
   558      * @since Series 60 2.6
       
   559      * @param aUuid Source device UUID. 
       
   560      * @param aSessionId 
       
   561      * @param aErr UPnP error code.
       
   562      * @param aContainerId
       
   563      * @param aSearchCriteria
       
   564      * @param aFilter
       
   565      * @param aIndex
       
   566      * @param arequest
       
   567      * @param aSortCriteria
       
   568      * @param aResult
       
   569      * @param aReturned
       
   570      * @param aMatches
       
   571      * @param aUpdateID
       
   572      */
       
   573      
       
   574     void CdsSearchResponse(
       
   575         const TDesC8& aUuid,
       
   576         TInt aSessionId,
       
   577         TInt aErr,
       
   578         const TDesC8& aContainerId,
       
   579         const TDesC8& aSearchCriteria,
       
   580         const TDesC8& aFilter,
       
   581         TInt aIndex,
       
   582         TInt aRequest,
       
   583         const TDesC8& aSortCriteria,
       
   584         const TDesC8& aResult,
       
   585         TInt aReturned,
       
   586         TInt aMatches,
       
   587         const TDesC8& aUpdateID);
       
   588         
       
   589     /**
       
   590      * Observer callback for Content Directory DestroyObject function.
       
   591      * @since Series 60 2.6
       
   592      * @param aUuid Source device UUID. 
       
   593      * @param aSessionId 
       
   594      * @param aErr UPnP error code.
       
   595      * @param aObjectId
       
   596      */
       
   597     void CdsDestroyObjectResponse(
       
   598         const TDesC8& aUuid,
       
   599         TInt aSessionId,
       
   600         TInt aErr,
       
   601         const TDesC8& aObjectId );
       
   602         
       
   603     /**
       
   604      * Observer callback for Content Directory UpdateObject function.
       
   605      * @since Series 60 2.6
       
   606      * @param aUuid Source device UUID. 
       
   607      * @param aSessionId 
       
   608      * @param aErr UPnP error code.
       
   609      * @param aObjectId
       
   610      * @param aCurrentTagValue
       
   611      * @param aNewTagValue
       
   612      */
       
   613     void CdsUpdateObjectResponse(
       
   614         const TDesC8& aUuid,
       
   615         TInt aSessionId,
       
   616         TInt aErr,
       
   617         const TDesC8& aObjectId,
       
   618         const TDesC8& aCurrentTagValue,
       
   619         const TDesC8& aNewTagValue );
       
   620         
       
   621     /**
       
   622      * Observer callback for Content Directory ImportResource function.
       
   623      * @since Series 60 2.6
       
   624      * @param aUuid Source device UUID. 
       
   625      * @param aSessionId 
       
   626      * @param aErr UPnP error code.
       
   627      * @param aSourceURI
       
   628      * @param aDestinationURI
       
   629      * @param aTransferId
       
   630      */       
       
   631     void CdsImportResponse(
       
   632         const TDesC8& aUuid,
       
   633         TInt aSessionId,
       
   634         TInt aErr,
       
   635         const TDesC8& aSourceURI,
       
   636         const TDesC8& aDestinationURI,
       
   637         const TDesC8& aTransferId );
       
   638         
       
   639     /**
       
   640      * Observer callback for Content Directory ExportResource function.
       
   641      * @since Series 60 2.6
       
   642      * @param aUuid Source device UUID. 
       
   643      * @param aSessionId 
       
   644      * @param aErr UPnP error code.
       
   645      * @param aSourceURI
       
   646      * @param aDestinationURI
       
   647      * @param aTransferId
       
   648      */       
       
   649     void CdsExportResponse(
       
   650         const TDesC8& aUuid,
       
   651         TInt aSessionId,
       
   652         TInt aErr,
       
   653         const TDesC8& aSourceURI,
       
   654         const TDesC8& aDestinationURI,
       
   655         const TDesC8& aTransferId );
       
   656         
       
   657     /**
       
   658      * Observer callback for Content Directory StopTransfer function.
       
   659      * @since Series 60 2.6
       
   660      * @param aUuid Source device UUID. 
       
   661      * @param aSessionId 
       
   662      * @param aErr UPnP error code.
       
   663      * @param aSourceURI
       
   664      * @param aDestinationURI
       
   665      * @param aTransferId
       
   666      */       
       
   667     void CdsStopTransferResponse(
       
   668         const TDesC8& aUuid,
       
   669         TInt aSessionId,
       
   670         TInt aErr,
       
   671         const TDesC8& aTransferId );
       
   672     
       
   673     /**
       
   674      * Observer callback for Content Directory GetTransferProgress function.
       
   675      * @since Series 60 2.6
       
   676      * @param aUuid Source device UUID. 
       
   677      * @param aSessionId 
       
   678      * @param aErr UPnP error code.
       
   679      * @param aTransferId
       
   680      * @param aTransferStatus
       
   681      * @param aTransferTotal
       
   682      */         
       
   683     virtual void CdsCTransferProgressResponse(
       
   684         const TDesC8& aUuid,
       
   685         TInt aSessionId,
       
   686         TInt aErr,
       
   687         const TDesC8& aTransferId,
       
   688         const TDesC8& aTransferStatus,
       
   689         const TDesC8& aTransferLength,            
       
   690         const TDesC8& aTransferTotal );
       
   691         
       
   692     /**
       
   693      * Observer callback for Content Directory DeleteResource function.
       
   694      * @since Series 60 2.6
       
   695      * @param aUuid Source device UUID. 
       
   696      * @param aSessionId 
       
   697      * @param aErr UPnP error code.
       
   698      * @param aResourceUri Resource to be deleted.
       
   699      */ 
       
   700     void CdsDeleteResourceResponse(
       
   701         const TDesC8& aUuid,
       
   702         TInt aSessionId,
       
   703         TInt aErr,
       
   704         const TDesC8& aResourceUri );
       
   705         
       
   706     /**
       
   707      * Observer callback for Content Directory CreateReference function.
       
   708      * @since Series 60 2.6
       
   709      * @param aUuid Source device UUID. 
       
   710      * @param aSessionId 
       
   711      * @param aErr UPnP error code.
       
   712      * @param aContainerId Destination folder.
       
   713      * @param aObjectId Source object.
       
   714      * @param aNewId Created reference.
       
   715      */ 
       
   716     void CdsCreateReferenceResponse(
       
   717         const TDesC8& aUuid,
       
   718         TInt aSessionId,
       
   719         TInt aErr,
       
   720         const TDesC8& aContainerId, 
       
   721         const TDesC8& aObjectId, 
       
   722         const TDesC8& aNewId );
       
   723         
       
   724     /**
       
   725      * Observer callback for Content Directory CreateReference function.
       
   726      * @since Series 60 2.6
       
   727      * @param aUuid Source device UUID. 
       
   728      * @param aSessionId 
       
   729      * @param aErr UPnP error code.
       
   730      * @param aContainerID Container in which new object is created.
       
   731      * @param aElements Elements for item creation.
       
   732      * @param aObjectID New objects ID.
       
   733      * @param aResult Result of the action.
       
   734      */ 
       
   735     void CdsCreateObjectResponse(
       
   736         const TDesC8& aUuid,
       
   737         TInt aSessionId,
       
   738         TInt aErr,
       
   739         const TDesC8& aContainerID, 
       
   740         const TDesC8& aElements, 
       
   741         const TDesC8& aObjectID, 
       
   742         const TDesC8& aResult );
       
   743         
       
   744 
       
   745     /**
       
   746      * Observer callback for Connection Manager GetProtocolInfo function.
       
   747      * @since Series 60 2.6
       
   748      * @param aUuid Source device UUID. 
       
   749      * @param aSessionId 
       
   750      * @param aErr UPnP error code.
       
   751      * @param aSource
       
   752      * @param aSink
       
   753      */ 
       
   754     void CmProtocolInfoResponse(
       
   755         const TDesC8& aUuid,
       
   756         TInt aSessionId,
       
   757         TInt aErr,
       
   758         const TDesC8& aSource, 
       
   759         const TDesC8& aSink );
       
   760     
       
   761     /**
       
   762      * Observer callback for Connection Manager PrepareForConnection 
       
   763      * function.
       
   764      * @since Series 60 2.6
       
   765      * @param aUuid Source device UUID. 
       
   766      * @param aSessionId 
       
   767      * @param aErr UPnP error code.
       
   768      * @param aRemoteProtocolInfo
       
   769      * @param aPeerConnectionManager
       
   770      * @param aPeerConnectionId
       
   771      * @param aDirection
       
   772      * @param aConnection
       
   773      * @param aTransport
       
   774      * @param aRsc
       
   775      */        
       
   776     void CmPrepareResponse(
       
   777         const TDesC8& aUuid,
       
   778         TInt aSessionId,
       
   779         TInt aErr,
       
   780         const TDesC8& aRemoteProtocolInfo,
       
   781         const TDesC8& aPeerConnectionManager,
       
   782         const TDesC8& aPeerConnectionId,
       
   783         const TDesC8& aDirection,
       
   784         TInt aConnection,
       
   785         TInt aTransport,
       
   786         TInt aRsc );
       
   787     
       
   788     /**
       
   789      * Observer callback for Connection Manager ConnectionComplete 
       
   790      * function.
       
   791      * @since Series 60 2.6
       
   792      * @param aUuid Source device UUID. 
       
   793      * @param aSessionId 
       
   794      * @param aErr UPnP error code.
       
   795      * @param aConnection
       
   796      */         
       
   797     void CmComplete(
       
   798         const TDesC8& aUuid,
       
   799         TInt aSessionId,
       
   800         TInt aErr,
       
   801         TInt aConnection );
       
   802         
       
   803     /**
       
   804      * Observer callback for Connection Manager GetCurrentConnectionIDs
       
   805      * function.
       
   806      * @since Series 60 2.6
       
   807      * @param aUuid Source device UUID. 
       
   808      * @param aSessionId 
       
   809      * @param aErr UPnP error code.
       
   810      * @param aConnection
       
   811      */         
       
   812     void CmCurrentConnections(
       
   813         const TDesC8& aUuid,
       
   814         TInt aSessionId,
       
   815         TInt aErr,
       
   816         const TDesC8& aConnections);
       
   817         
       
   818     /**
       
   819      * Observer callback for Connection Manager GetCurrentConnectionInfo
       
   820      * function.
       
   821      * @since Series 60 2.6
       
   822      * @param aUuid Source device UUID. 
       
   823      * @param aSessionId 
       
   824      * @param aErr UPnP error code.
       
   825      * @param rscId
       
   826      * @param aProtocolInfo
       
   827      * @param aPeerConnectionManager
       
   828      * @param peerId
       
   829      * @param aStatus
       
   830      */   
       
   831     void CmCurrentInfo(
       
   832         const TDesC8& aUuid,
       
   833         TInt aSessionId,
       
   834         TInt aErr,
       
   835         TInt rscId, 
       
   836         TInt transportId, 
       
   837         const TDesC8& aProtocolInfo,
       
   838         const TDesC8& aPeerConnectionManager, 
       
   839         TInt peerId, 
       
   840         const TDesC8& aDirection, 
       
   841         const TDesC8& aStatus );
       
   842 
       
   843     //*****************************************************************
       
   844     //Functions for UPnP event handling
       
   845     //*****************************************************************
       
   846     /**
       
   847      * Content Directory SystemUpdateId event handler.
       
   848      * @since Series 60 2.6
       
   849      * @param aUuid Device UUID.
       
   850      * @param aSystemUpdateId Device systemUpdateId.
       
   851      */
       
   852     void CdsUpdateEvent(
       
   853             const TDesC8& aUuid,
       
   854             TInt aSystemUpdateId
       
   855             );
       
   856             
       
   857     /**
       
   858      * Content Directory ContainerUpdateIDs event handler.
       
   859      * @since Series 60 2.6
       
   860      * @param aUuid Device UUID.
       
   861      * @param aConteinerIds Device container update ids.
       
   862      */
       
   863     void CdsContainerEvent(
       
   864             const TDesC8& aUuid,
       
   865             const TDesC8& aConteinerIds
       
   866             );
       
   867             
       
   868     /**
       
   869      * Content Directory TransferIDs event handler.
       
   870      * @since Series 60 2.6
       
   871      * @param aUuid Device UUID.
       
   872      * @param aTransferIds Device transfer ids.
       
   873      */
       
   874     void CdsTransferEvent(
       
   875             const TDesC8& aUuid,
       
   876             const TDesC8& aTransferIds
       
   877             );
       
   878             
       
   879     /**
       
   880      * Rendering Control LastChange event handler.
       
   881      * @since Series 60 2.6
       
   882      * @param aUuid Device UUID.
       
   883      * @param aLastChange Device LastChange statevariable.
       
   884      */
       
   885     void RcLastChangeEvent(
       
   886             const TDesC8& aUuid,
       
   887             const TDesC8& aLastChange
       
   888             );
       
   889             
       
   890     /**
       
   891      * AV Transport LastChange event handler.
       
   892      * @since Series 60 2.6
       
   893      * @param aUuid Device UUID.
       
   894      * @param aLastChange Device LastChange statevariable.
       
   895      */
       
   896     void AvtLastChangeEvent(
       
   897             const TDesC8& aUuid,
       
   898             const TDesC8& aLastChange
       
   899             );
       
   900     /**
       
   901      * Connection Manager SourceEvent event handler.
       
   902      * @since Series 60 2.6
       
   903      * @param aUuid Device UUID.
       
   904      * @param aSource Device's source info.
       
   905      */
       
   906     void CmSourceEvent(
       
   907             const TDesC8& aUuid,
       
   908             const TDesC8& aSource
       
   909             );
       
   910             
       
   911     /**
       
   912      * Connection Manager SinkEvent event handler.
       
   913      * @since Series 60 2.6
       
   914      * @param aUuid Device UUID.
       
   915      * @param aSink Device's sink info.
       
   916      */
       
   917     void CmSinkEvent(
       
   918             const TDesC8& aUuid,
       
   919             const TDesC8& aSink
       
   920             );
       
   921             
       
   922     /**
       
   923      * Connection Manager ConnectionsEvent event handler.
       
   924      * @since Series 60 2.6
       
   925      * @param aUuid Device UUID.
       
   926      * @param aConnections Devices connections.
       
   927      */
       
   928     void CmConnectionsEvent(
       
   929             const TDesC8& aUuid,
       
   930             const TDesC8& aConnections
       
   931             );
       
   932     //*****************************************************************
       
   933     // Device and http functions.
       
   934     //*****************************************************************
       
   935     /**
       
   936      * Handles HTTP messages.
       
   937      * @since Series 60 2.6
       
   938      * @param aMessage Incoming HTTP message.
       
   939      */
       
   940     void HttpResponseL( CUpnpHttpMessage* aMessage );
       
   941 
       
   942 public:
       
   943 
       
   944     /**
       
   945      * Handles UPnP device discoveries.
       
   946      * @since Series 60 2.6
       
   947      * @param aDevice Device that is discovered.
       
   948      */
       
   949     void DeviceDiscoveredL( CUpnpDevice* aDevice );
       
   950 
       
   951     /**
       
   952      * Handles UPnP device disappears.
       
   953      * @since Series 60 2.6
       
   954      * @param aDevice Device that disappeared.
       
   955      */
       
   956     void DeviceDisappearedL( CUpnpDevice* aDevice );    
       
   957  
       
   958 protected: // From CUpnpMediaServerNotifier
       
   959 
       
   960     /**
       
   961      * Called when Content Directory file transfer is finished
       
   962      * either with success or failure.
       
   963      * See CUpnpFileTransferEvent class description for details.
       
   964      *
       
   965      * @since Series 60 3.1
       
   966      * @param aEvents Media Server event
       
   967      * @return notifier object
       
   968      */
       
   969     void FileTransferEvent( CUpnpFileTransferEvent *aEvent );
       
   970     
       
   971     /**
       
   972      * Called when Content Directory file transfer is finished
       
   973      * and iInternalState == ECopyToPhone
       
   974      * @since Series 60 3.2
       
   975      * @param aEvent Media Server event
       
   976      * @param aError from FileTransferEvent
       
   977      */
       
   978     void HandleCopyToPhoneEventL( 
       
   979         CUpnpFileTransferEvent& aEvent, 
       
   980         TInt aError );
       
   981 
       
   982     /**
       
   983      * Called in case of CUpnpMediaServerNotifier internal error.
       
   984      * Should be used for event handling recovery.
       
   985      *
       
   986      * @since Series 60 3.1
       
   987      * @param aObserver event observer
       
   988      * @return notifier object
       
   989      */
       
   990     void NotifierError( TInt aError );
       
   991     
       
   992 public: // New functions
       
   993 
       
   994     /**
       
   995      * Handles UPnP device disappears.
       
   996      *
       
   997      * @param aDevice Device that disappeared.
       
   998      */
       
   999     void DeviceDisappearedL( CUpnpAVDeviceExtended& aDevice );
       
  1000 
       
  1001     /**
       
  1002      * Sets local (S60) Media Server Uuid
       
  1003      *
       
  1004      * @param aUuid device Uuid
       
  1005      */
       
  1006     void SetLocalMSUuidL( const TDesC8& aUuid );
       
  1007 
       
  1008     /**
       
  1009      * Returns Session Id
       
  1010      *
       
  1011      * @return session id
       
  1012      */
       
  1013     TInt SessionId() const;
       
  1014     
       
  1015     /**
       
  1016      * Returns device Uuid 
       
  1017      *
       
  1018      * @return device Uuid
       
  1019      */
       
  1020     const TDesC8& Uuid() const;
       
  1021     
       
  1022 public:
       
  1023 
       
  1024     /**
       
  1025      * See upnpavcontrollerimpl.h
       
  1026      */
       
  1027     void GetBrowseResponseSizeL( const RMessage2& aMessage );  
       
  1028 
       
  1029     /**
       
  1030      * See upnpavcontrollerimpl.h
       
  1031      */
       
  1032     void CancelGetBrowseResponseSizeL();
       
  1033 
       
  1034     /**
       
  1035      * See upnpavcontrollerimpl.h
       
  1036      */
       
  1037     void GetBrowseResponseL( const RMessage2& aMessage );
       
  1038     
       
  1039     /**
       
  1040      * See upnpavcontrollerimpl.h
       
  1041      */
       
  1042     void GetSearchResponseSizeL( const RMessage2& aMessage );
       
  1043 
       
  1044     /**
       
  1045      * See upnpavcontrollerimpl.h
       
  1046      */
       
  1047     void CancelGetSearchResponseSizeL();
       
  1048 
       
  1049     /**
       
  1050      * See upnpavcontrollerimpl.h
       
  1051      */
       
  1052     void GetSearchResponseL( const RMessage2& aMessage );
       
  1053 
       
  1054     /**
       
  1055      * See upnpavcontrollerimpl.h
       
  1056      */
       
  1057     void GetSearchCapabitiesSizeL( const RMessage2& aMessage );
       
  1058     
       
  1059     /**
       
  1060      * See upnpavcontrollerimpl.h
       
  1061      */
       
  1062     void CancelGetSearchCapabitiesSizeL();     
       
  1063     
       
  1064     /**
       
  1065      * See upnpavcontrollerimpl.h
       
  1066      */
       
  1067     void GetSearchCapabitiesL( const RMessage2& aMessage );
       
  1068     
       
  1069     /**
       
  1070      * See upnpavcontrollerimpl.h
       
  1071      */
       
  1072     void CreateContainerL( const RMessage2& aMessage );
       
  1073     
       
  1074     /**
       
  1075      * See upnpavcontrollerimpl.h
       
  1076      */
       
  1077     void CancelCreateContainerL();
       
  1078     
       
  1079     /**
       
  1080      * See upnpavcontrollerimpl.h
       
  1081      */
       
  1082     void DeleteObjectL( const RMessage2& aMessage );
       
  1083     
       
  1084     /**
       
  1085      * See upnpavcontrollerimpl.h
       
  1086      */
       
  1087     void CancelDeleteObjectL();
       
  1088     
       
  1089     /**
       
  1090      * See upnpavcontrollerimpl.h
       
  1091      */
       
  1092     void DeviceDisappearedRequestL( const RMessage2& aMessage );
       
  1093     
       
  1094     /**
       
  1095      * See upnpavcontrollerimpl.h
       
  1096      */
       
  1097     void CancelDeviceDisappearedRequestL();
       
  1098                                    
       
  1099 private:
       
  1100 
       
  1101     /**
       
  1102      * Parses create object -action response and returns import uri.
       
  1103      *
       
  1104      * @param aResponse create object -action response
       
  1105      * @return import uri (ownership is transferred)
       
  1106      */
       
  1107     HBufC8* ParseCreateObjectResponseL( const TDesC8& aResponse );
       
  1108 
       
  1109     /**
       
  1110      * Parses browse response and checks if the container supports the 
       
  1111      * media type we are about to copy into it
       
  1112      *
       
  1113      * @param aResponse browse response
       
  1114      */
       
  1115     void CheckIsCreateObjectSupportedL( const TDesC8& aResponse );
       
  1116 
       
  1117     /**
       
  1118      * Parses browse response and checks if the container supports the 
       
  1119      * media type we are about to copy into it. After that it sends
       
  1120      * a create object -action.
       
  1121      *
       
  1122      * @param aResponse browse response
       
  1123      */
       
  1124     void CheckAndSendCreateObjectActionL( const TDesC8& aResponse );
       
  1125 
       
  1126     /**
       
  1127      * Parses browse response and checks if the object can be deleted. If
       
  1128      * supported, sends destroyobject-action.
       
  1129      *
       
  1130      * @param aResponse browse response
       
  1131      */
       
  1132     void CheckAndSendDestroyObjectActionL( const TDesC8& aResponse );    
       
  1133     
       
  1134     /**
       
  1135      * Sends a create object -action
       
  1136      *
       
  1137      * @param aUuid device uuid
       
  1138      * @param aContainerId container id
       
  1139      * @param aResponse elements xml
       
  1140      */
       
  1141     void SendCreateObjectActionL( const TDesC8& aUuid,
       
  1142         const TDesC8& aContainerId, const TDesC8& aResponse );
       
  1143 
       
  1144     /**
       
  1145      * Sends export resource -action
       
  1146      */
       
  1147     void SendExportActionL();
       
  1148     
       
  1149     /**
       
  1150      * Sends import resource -action
       
  1151      */
       
  1152     void SendImportActionL();
       
  1153 
       
  1154     /**
       
  1155      * Resets internal state
       
  1156      */
       
  1157     void ResetL();
       
  1158         
       
  1159     /**
       
  1160      * Postprocesses copy operation
       
  1161      *
       
  1162      * @param aError error code in copying
       
  1163      * @param aFinished state of copy (create object/ import/export action)
       
  1164      */
       
  1165     void CopyFinished( TInt aError, TBool aFinished ); 
       
  1166     
       
  1167     /**
       
  1168      * Reads an object from a message
       
  1169      *
       
  1170      * @param aMessage client/server message
       
  1171      * @param aSlot message slot number
       
  1172      * @param aObj UPnP object
       
  1173      */
       
  1174     void ReadObjFromMessageL( const RMessage2& aMessage, TInt aSlot,
       
  1175         CUpnpObject* aObj );
       
  1176         
       
  1177     /**
       
  1178      * Reads a request from a message
       
  1179      *
       
  1180      * @param aMessage client/server message
       
  1181      * @param aSlot message slot number
       
  1182      * @param aReq request
       
  1183      */
       
  1184     void ReadReqFromMessageL( const RMessage2& aMessage, TInt aSlot,
       
  1185         CUpnpAVRequest* aReq );
       
  1186         
       
  1187     /**
       
  1188      * Reads a browse request from a message
       
  1189      *
       
  1190      * @param aMessage client/server message
       
  1191      * @param aSlot message slot number
       
  1192      * @param aReq browse request
       
  1193      */
       
  1194     void ReadBrowseReqFromMessageL( const RMessage2& aMessage, TInt aSlot,
       
  1195         CUpnpAVBrowseRequest* aReq );
       
  1196 
       
  1197     /**
       
  1198      * Reads a buffer from a message
       
  1199      *
       
  1200      * @param aMessage client/server message
       
  1201      * @param aSlot message slot number
       
  1202      * @return a buffer (heap descriptor)
       
  1203      */
       
  1204     HBufC8* ReadBufFromMessageLC( const RMessage2& aMessage, TInt aSlot );
       
  1205 
       
  1206     /**
       
  1207      * Sets download settings. Not currently needed, for future use.
       
  1208      *
       
  1209      * @param aType download location
       
  1210      */
       
  1211     void SetDownloadSettingsL( MUPnPAVBrowsingSession::TMemoryType aType );
       
  1212     
       
  1213     /**
       
  1214      * Restores download settings. Not currently needed, for future use.
       
  1215      *
       
  1216      * @return error code
       
  1217      */
       
  1218     TInt RestoreDownloadSettings();
       
  1219     
       
  1220     /**
       
  1221      * Checks sharing status. Determines if the copied file is left shared or
       
  1222      * not.
       
  1223      *
       
  1224      * @return error code
       
  1225      */
       
  1226     TInt CheckSharingStatus();                      
       
  1227 
       
  1228 private:
       
  1229 
       
  1230     RUpnpMediaServerClient&     iMediaServer; // Not own
       
  1231 
       
  1232     CUpnpAVControllerServer&    iServer;
       
  1233     
       
  1234     TInt                        iSessionId;
       
  1235 
       
  1236     TInt                        iInstanceId;
       
  1237     
       
  1238     TInt                        iIPSessionId;
       
  1239 
       
  1240     TInt                        iTransferId;
       
  1241     
       
  1242     TBool                       iTransferEventReceived;
       
  1243     
       
  1244     TInternalBrowseState        iInternalState;
       
  1245     
       
  1246     TInternalCopyState          iCopyState;
       
  1247     
       
  1248     RMessage2*                  iActionMessage; // Own
       
  1249     
       
  1250     RMessage2*                  iDeviceMessage; // Own
       
  1251     
       
  1252     CUpnpAVDeviceExtended*      iDevice; // Own
       
  1253     
       
  1254     HBufC8*                     iLocalMediaServerUuid; // Own
       
  1255     
       
  1256     HBufC8*                     iRespBuf; // Own
       
  1257     
       
  1258     HBufC8*                     iRespBuf2; // Own  
       
  1259         
       
  1260     HBufC8*                     iImportURI; // Own
       
  1261     
       
  1262     HBufC8*                     iSourceURI; // Own
       
  1263     
       
  1264     HBufC8*                     iItemId; // Own
       
  1265     
       
  1266     HBufC8*                     iContainerId; // Own
       
  1267     
       
  1268     CUpnpItem*                  iSharedItem; // Own  
       
  1269     
       
  1270     CUPnPFileSharingActive*     iFileSharing; // Own
       
  1271       
       
  1272     CUpnpMediaServerNotifier*   iMediaServerNotifier; // Own
       
  1273     
       
  1274     HBufC8*                     iOriginalLocation; // Own
       
  1275     
       
  1276     HBufC8*                     iFilePath; // Own
       
  1277     
       
  1278     CUpnpMediaServerSettings*   iMSSettings; // Own, For future use
       
  1279     
       
  1280     CRepository*                iAppSettings; // Own
       
  1281 
       
  1282     MUPnPAVBrowsingSession::TFileSharing iShareFlag;    
       
  1283     
       
  1284     TBool                       iMusic;
       
  1285     
       
  1286     TInt                        iAsyncErr;
       
  1287     
       
  1288     };
       
  1289 
       
  1290 #endif // C_UPNPBROWSINGSESSION_H