upnpavcontroller/upnpavcontrollerserver/inc/upnpbrowsingsession.h
branchnew development branch with rendering state machine and other goodies
changeset 38 5360b7ddc251
parent 0 7f85d04be362
equal deleted inserted replaced
32:3785f754ee62 38:5360b7ddc251
    15 *
    15 *
    16 */
    16 */
    17 
    17 
    18 
    18 
    19 
    19 
    20 
       
    21 
       
    22 
       
    23 
       
    24 #ifndef C_UPNPBROWSINGSESSION_H
    20 #ifndef C_UPNPBROWSINGSESSION_H
    25 #define C_UPNPBROWSINGSESSION_H
    21 #define C_UPNPBROWSINGSESSION_H
    26 
    22 
    27 // INCLUDE FILES
    23 // INCLUDE FILES
    28 #include <e32base.h>
    24 #include <e32base.h>
    29 #include "upnpavcontroller.h"
    25 #include "upnpavcontroller.h"
    30 #include <upnpavcontrolpointobserver.h>
       
    31 #include <upnpmediaserverobserver.h>
    26 #include <upnpmediaserverobserver.h>
    32 #include "upnpavbrowsingsession.h"
    27 #include "upnpavbrowsingsession.h"
    33 
    28 
       
    29 #include "upnpavcontrolpointobserver.h"
       
    30 
    34 
    31 
    35 // FORWARD DECLARATIONS
    32 // FORWARD DECLARATIONS
    36 class CUpnpItem;
       
    37 class CUpnpObject;
    33 class CUpnpObject;
       
    34 class CUpnpDevice;
    38 class CUpnpAVRequest;
    35 class CUpnpAVRequest;
    39 class CUpnpAVBrowseRequest;
    36 class CUpnpAVBrowseRequest;
    40 class CUPnPFileSharingActive;
       
    41 class CUpnpMediaServerNotifier;
       
    42 class RUpnpMediaServerClient;
       
    43 class CUpnpAVDeviceExtended;
    37 class CUpnpAVDeviceExtended;
    44 class CUpnpMediaServerSettings;
       
    45 class CRepository;
       
    46 class CUpnpAVControllerServer;
    38 class CUpnpAVControllerServer;
       
    39 
    47 /**
    40 /**
    48  * Implements server side browsing session functionality. Implements
    41  * Implements server side browsing session functionality. Implements
    49  * browsing, searching, copying etc.  
    42  * browsing, searching, copying etc.  
    50  *
    43  *
    51  * @since S60 v3.1
    44  * @since S60 v3.1
    52  */
    45  */
    53 class CUPnPBrowsingSession :    public CBase,
    46 class CUPnPBrowsingSession : public CBase,
    54                                 public MUpnpAVControlPointObserver,
    47                              private MUpnpAVControlPointObserver
    55                                 public MUpnpMediaServerObserver
       
    56     {
    48     {
    57 
    49 
    58 private:
    50 private:
    59 
    51 
    60     /**
    52     /**
    63     enum TInternalBrowseState
    55     enum TInternalBrowseState
    64         {
    56         {
    65         ENone,
    57         ENone,
    66         EBrowse,
    58         EBrowse,
    67         EDestroyObject,
    59         EDestroyObject,
    68         ECopyLocal,
       
    69         ECreateContainer,
    60         ECreateContainer,
    70         ECopyToPhone
       
    71         };
    61         };
    72 
    62 
    73     enum TInternalCopyState
       
    74         {
       
    75         EIdle,
       
    76         EObjectCreated,
       
    77         ECopying
       
    78         };
       
    79 
    63 
    80 public:
    64 public:
    81 
    65 
    82     /**
    66     /**
    83      * Static 1st phase constructor
    67      * Static 1st phase constructor
    88      * @param aSessionId session id
    72      * @param aSessionId session id
    89      * @param aUuid device Uuid
    73      * @param aUuid device Uuid
    90      */
    74      */
    91     static CUPnPBrowsingSession* NewL
    75     static CUPnPBrowsingSession* NewL
    92         (
    76         (
    93         RUpnpMediaServerClient& aClient,
       
    94         CUpnpAVControllerServer& aServer,
    77         CUpnpAVControllerServer& aServer,
    95         TInt aSessionId,   
    78         TInt aSessionId,   
    96         const TDesC8& aUuid
    79         const TDesC8& aUuid
    97         );
    80         );
    98     
    81     
   111      * @param aDispatcher observer callback dispatcher reference
    94      * @param aDispatcher observer callback dispatcher reference
   112      * @param aSessionId session id
    95      * @param aSessionId session id
   113      */
    96      */
   114     CUPnPBrowsingSession
    97     CUPnPBrowsingSession
   115         (
    98         (
   116         RUpnpMediaServerClient& aClient,
       
   117         CUpnpAVControllerServer& aServer,
    99         CUpnpAVControllerServer& aServer,
   118         TInt aSessionId
   100         TInt aSessionId
   119         );    
   101         );    
   120     
   102     
   121     /**
   103     /**
   122      * 2ns phase constructor
   104      * 2ns phase constructor
   123      */
   105      */
   124     void ConstructL( const TDesC8& aUuid );
   106     void ConstructL( const TDesC8& aUuid );
   125 
   107 
   126 protected: // From MUpnpAVControlPointObserver
   108 private: // From MUpnpAVControlPointObserver
   127 
   109 
   128     /**
   110     void ActionResponseL(CUpnpAction* aAction );
   129      * Observer callback for rendering control Set Volume.
   111     void StateUpdatedL(CUpnpService* aService);
   130      * @since Series 60 2.6
   112     void HttpResponseL(CUpnpHttpMessage* aMessage);
   131      * @param aUuid Source device UUID. 
   113     void DeviceDiscoveredL(CUpnpDevice* aDevice);
   132      * @param aSessionId 
   114     void DeviceDisappearedL(CUpnpDevice* aDevice);
   133      * @param aErr UPnP error code.
   115 
   134      * @param aInstance rendering instance.
   116 private: // network event handling
   135      * @param aChannel audio channel.
   117 
   136      * @param aDesiredVolume 
   118     /**
   137      */
   119      * Handles response for ContentDirectory SearchCapabilities command
   138     void RcSetVolumeResponse(
   120      */
   139         const TDesC8& aUuid,
   121     void CdsSearchCapabilitiesResponse(
   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,
   122         TInt aErr,
   215         const TDesC8& aInstanceId,
   123         const TDesC8& aSearchCaps );
   216         const TDesC8& aCurrentUri,
   124 
   217         const TDesC8& aCurrentUriMetaData);
   125     /**
   218         
   126      * Handles response for ContentDirectory Browse command
   219     /**
   127      */
   220      * Observer callback for rendering control AV set next transport uri.
   128     void CdsBrowseResponseL(
   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,
   129         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,
   130         const TDesC8&  aBrowseFlag,
   547         const TDesC8&  aFilter,
       
   548         TInt aIndex,
       
   549         TInt aRequest,
       
   550         const TDesC8&  aSortCriteria,
       
   551         const TDesC8&  aResult,
   131         const TDesC8&  aResult,
   552         TInt aReturned,
   132         TInt aReturned,
   553         TInt aMatches,
   133         TInt aMatches,
   554         const TDesC8&  aUpdateID);
   134         const TDesC8& aUpdateID );
   555         
   135 
   556     /**
   136     /**
   557      * Observer callback for Content Directory Search function.
   137      * Handles response for ContentDirectory Search command
   558      * @since Series 60 2.6
   138      */
   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(
   139     void CdsSearchResponse(
   575         const TDesC8& aUuid,
       
   576         TInt aSessionId,
       
   577         TInt aErr,
   140         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,
   141         const TDesC8& aResult,
   585         TInt aReturned,
   142         TInt aReturned,
   586         TInt aMatches,
   143         TInt aMatches,
   587         const TDesC8& aUpdateID);
   144         const TDesC8& aUpdateID );
   588         
   145 
   589     /**
   146     /**
   590      * Observer callback for Content Directory DestroyObject function.
   147      * Handles response for ContentDirectory DestroyObject command
   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      */
   148      */
   597     void CdsDestroyObjectResponse(
   149     void CdsDestroyObjectResponse(
   598         const TDesC8& aUuid,
   150         TInt aErr );
   599         TInt aSessionId,
   151 
       
   152     /**
       
   153      * Handles response for ContentDirectory CreateObject command
       
   154      */
       
   155     void CdsCreateObjectResponse(
   600         TInt aErr,
   156         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, 
   157         const TDesC8& aObjectID, 
   742         const TDesC8& aResult );
   158         const TDesC8& aResult );
   743         
   159 
   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
   160 public: // New functions
   993 
   161 
   994     /**
   162     /**
   995      * Handles UPnP device disappears.
   163      * Handles UPnP device disappears.
   996      *
   164      *
  1096      */
   264      */
  1097     void CancelDeviceDisappearedRequestL();
   265     void CancelDeviceDisappearedRequestL();
  1098                                    
   266                                    
  1099 private:
   267 private:
  1100 
   268 
  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 
   269 
  1126     /**
   270     /**
  1127      * Parses browse response and checks if the object can be deleted. If
   271      * Parses browse response and checks if the object can be deleted. If
  1128      * supported, sends destroyobject-action.
   272      * supported, sends destroyobject-action.
  1129      *
   273      *
  1130      * @param aResponse browse response
   274      * @param aResponse browse response
  1131      */
   275      */
  1132     void CheckAndSendDestroyObjectActionL( const TDesC8& aResponse );    
   276     void CheckAndSendDestroyObjectActionL( const TDesC8& aResponse );    
  1133     
   277     
  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 
   278 
  1154     /**
   279     /**
  1155      * Resets internal state
   280      * Resets internal state
  1156      */
   281      */
  1157     void ResetL();
   282     void ResetL();
  1158         
   283         
  1159     /**
   284 
  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     /**
   285     /**
  1168      * Reads an object from a message
   286      * Reads an object from a message
  1169      *
   287      *
  1170      * @param aMessage client/server message
   288      * @param aMessage client/server message
  1171      * @param aSlot message slot number
   289      * @param aSlot message slot number
  1201      * @param aSlot message slot number
   319      * @param aSlot message slot number
  1202      * @return a buffer (heap descriptor)
   320      * @return a buffer (heap descriptor)
  1203      */
   321      */
  1204     HBufC8* ReadBufFromMessageLC( const RMessage2& aMessage, TInt aSlot );
   322     HBufC8* ReadBufFromMessageLC( const RMessage2& aMessage, TInt aSlot );
  1205 
   323 
  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 
   324 
  1228 private:
   325 private:
  1229 
   326 
  1230     RUpnpMediaServerClient&     iMediaServer; // Not own
       
  1231 
       
  1232     CUpnpAVControllerServer&    iServer;
   327     CUpnpAVControllerServer&    iServer;
  1233     
   328     
  1234     TInt                        iSessionId;
   329     TInt                        iSessionId;
  1235 
   330 
  1236     TInt                        iInstanceId;
   331     TInt                        iInstanceId;
  1237     
   332     
  1238     TInt                        iIPSessionId;
   333     TInt                        iIPSessionId;
  1239 
   334 
  1240     TInt                        iTransferId;
       
  1241     
       
  1242     TBool                       iTransferEventReceived;
       
  1243     
       
  1244     TInternalBrowseState        iInternalState;
   335     TInternalBrowseState        iInternalState;
  1245     
   336     
  1246     TInternalCopyState          iCopyState;
       
  1247     
       
  1248     RMessage2*                  iActionMessage; // Own
   337     RMessage2*                  iActionMessage; // Own
  1249     
   338     
  1250     RMessage2*                  iDeviceMessage; // Own
   339     RMessage2*                  iDeviceMessage; // Own
  1251     
   340     
  1252     CUpnpAVDeviceExtended*      iDevice; // Own
   341     CUpnpAVDeviceExtended*      iDevice; // Own
       
   342 
       
   343     const CUpnpDevice*          iCpDevice; // Not own.    
  1253     
   344     
  1254     HBufC8*                     iLocalMediaServerUuid; // Own
   345     HBufC8*                     iLocalMediaServerUuid; // Own
  1255     
   346     
  1256     HBufC8*                     iRespBuf; // Own
   347     HBufC8*                     iRespBuf; // Own
  1257     
   348     
  1258     HBufC8*                     iRespBuf2; // Own  
   349     HBufC8*                     iRespBuf2; // Own  
  1259         
   350         
  1260     HBufC8*                     iImportURI; // Own
       
  1261     
       
  1262     HBufC8*                     iSourceURI; // Own
       
  1263     
       
  1264     HBufC8*                     iItemId; // Own
   351     HBufC8*                     iItemId; // Own
  1265     
   352     
  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     };
   353     };
  1289 
   354 
  1290 #endif // C_UPNPBROWSINGSESSION_H
   355 #endif // C_UPNPBROWSINGSESSION_H