upnpavcontrolpoint/avcpengine/inc/upnpresolvehandler.h
branchIOP_Improvements
changeset 40 08b5eae9f9ff
parent 39 6369bfd1b60d
child 41 b4d83ea1d6e2
equal deleted inserted replaced
39:6369bfd1b60d 40:08b5eae9f9ff
     1 /** @file
       
     2 * Copyright (c) 2005-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:  Resolve path(FS) into id (UPnP)
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CUPNPRESOLVEHANDLER_H
       
    20 #define C_CUPNPRESOLVEHANDLER_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include "upnpresponsehandler.h"
       
    25 #include "upnpresolverobserver.h"
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CUpnpPathResolver;
       
    29 class CUpnpAVCPManager;
       
    30 
       
    31 // CLASS DECLARATION
       
    32 /**
       
    33 * Class responsible for translating path into id.
       
    34 *
       
    35 *  @since Series 60 3.1
       
    36 */
       
    37 class CUpnpResolveHandler: public CBase, public MUpnpResponseHandler
       
    38 	{	
       
    39 	public:
       
    40 		/**
       
    41 		* Two-phased constructor.
       
    42 		*
       
    43 		* @param aAVCPManager manager
       
    44 		* @param aResolver path resolver
       
    45 		* @param aObserver observer to nofity
       
    46 		*/		
       
    47 		static CUpnpResolveHandler* NewL(CUpnpAVCPManager& aAVCPManager,
       
    48 			CUpnpPathResolver& aResolver, MUpnpResolverObserver& aObserver);	
       
    49 		/**
       
    50 		* Destructor.
       
    51 		*/			
       
    52 		virtual ~CUpnpResolveHandler();
       
    53 		/**
       
    54 		* Request for tranlating given path in to id.
       
    55 		* Method parses path into element and tries to match.
       
    56 		* Inform use about result by observer,
       
    57 		*
       
    58 		* @param aPath path
       
    59 		*/
       
    60 		void ResolveL(const TDesC8& aPath);
       
    61 		
       
    62 	public:	// Method from observers	
       
    63 		/**
       
    64 		* From MUpnpResponseHandler returns session id.
       
    65 		* It is also defined in MUpnpResponseHandler, MUpnpHttpResponseHandler
       
    66 		* @since Series 60 3.1
       
    67 		*/	
       
    68 		TInt SessionId();
       
    69 		/**
       
    70 		* From MUpnpResponseHandler, it is notified when SOAP respone 
       
    71 		* with relevant session id comes.
       
    72 		* @param aErrorCode error code
       
    73 		* @param aAction action with attached respone
       
    74 		* @since Series 60 3.1
       
    75 		*/	
       
    76 		void InterpretL(TInt aErrorCode, CUpnpAction* aAction);
       
    77 		/**
       
    78 		* From MUpnpResponseHandler, it is notified when leave appears 
       
    79 		* during InterpretL
       
    80 		* @param aErrorCode error code
       
    81 		* @since Series 60 3.1
       
    82 		*/
       
    83 		void RunError(TInt aErrorCode);
       
    84 				
       
    85 	private:
       
    86 		/**
       
    87 		* C++ default constructor.
       
    88 		*/	
       
    89 		CUpnpResolveHandler(CUpnpAVCPManager& aAVCPManager,
       
    90 			CUpnpPathResolver& aResolver, MUpnpResolverObserver& aObserver);
       
    91 			
       
    92 		/**
       
    93 		* Symbian 2nd phase constructor.
       
    94 		*/					
       
    95 		void ConstructL();
       
    96 		/**
       
    97 		* Check next element in path, if it is the last notify observer.
       
    98 		* If matching elemrnt wasn't found inform observer.
       
    99 		*
       
   100 		* @param aSendAction indicate whether use browse action 
       
   101 		*	if not found or inform used about error.
       
   102 		*/		
       
   103 		void CheckNextElementL(TBool aSendAction = ETrue);    
       
   104 		
       
   105 	private:
       
   106 		// manager
       
   107   	CUpnpAVCPManager& iAVCPManager;	
       
   108   	// resolver instance
       
   109 		CUpnpPathResolver& iResolver;
       
   110 		// observer
       
   111 		MUpnpResolverObserver& iObserver;
       
   112 		// array of path elements
       
   113 		RPointerArray<TPtrC8> iPathElements;	
       
   114 		// session id of last send SOAP action
       
   115 		TInt iSessionId; 	
       
   116 		// original pathname
       
   117 		HBufC8* iPath;
       
   118 		// last matched object id
       
   119 		HBufC8* iLastId;
       
   120 		// index of path elements, last checked
       
   121 		TInt iPathIndex;	
       
   122 		// index used to no get whole browse result
       
   123 		TInt iStartIndex;			
       
   124 		
       
   125 };
       
   126 
       
   127 #endif // C_CUPNPRESOLVEHANDLER_H