upnpavcontrolpoint/avcpengine/inc/upnpcommand.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:  Base class for all commands
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CUPNPCOMMAND_H
       
    20 #define C_CUPNPCOMMAND_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include "upnpavcpenginecommon.h"
       
    25 #include "upnpmdebug.h"
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 class CUpnpAVCPManager;
       
    29 class CUpnpAVCPEngineSession;
       
    30 class RMessage2;
       
    31 
       
    32 // CLASS DECLARATION
       
    33 /**
       
    34 *  Base abstract class defines common set of methods for all commands
       
    35 *
       
    36 *  @since Series 60 3.1
       
    37 */ 
       
    38 class CUpnpCommand : public CBase
       
    39 	{
       
    40 	public:  // Constructors and destructor
       
    41 		/**
       
    42 		* Two-phased constructor.
       
    43 		* Based on type of request it creates instance of relevant derived class
       
    44 		*
       
    45 		* @param aAVCPManager manager
       
    46 		* @param aSession server-side session
       
    47 		* @param aMessage message
       
    48 		*/
       
    49 		static CUpnpCommand* NewL(CUpnpAVCPManager& aAVCPManager, 
       
    50 													CUpnpAVCPEngineSession& aSession, 
       
    51 													const RMessage2& aMessage);        
       
    52 		/**
       
    53 		* Destructor.
       
    54 		*/
       
    55 		virtual ~CUpnpCommand();
       
    56 
       
    57 	public: // New functions    
       
    58 		/**
       
    59 		* Function defines operation to perform by derived command
       
    60 		*/		    
       
    61 		virtual void ExecuteL() = 0;    
       
    62 		/**
       
    63 		* Function set result from previous performed command.
       
    64 		* Command was performed and sent information about size of result to client-side.
       
    65 		* Base on command id session find corresponding instance of command and set result.
       
    66 		*/				    
       
    67 		virtual void SetResultL(const RMessage2& aMessage) = 0;    
       
    68 		/**
       
    69 		* Return command unique id
       
    70 		*
       
    71 		* @return command id;
       
    72 		*/    
       
    73 		TInt Id();
       
    74 		/**
       
    75 		* Return session id
       
    76 		*
       
    77 		* @return session id;
       
    78 		*/  		
       
    79 		TInt SessionId();
       
    80 		/**
       
    81 		* Function defines define default behaviour when leave appear during asynchrounous operation
       
    82 		*/		    
       
    83 		virtual void RunError(TInt aErrorCode);  		
       
    84 		
       
    85 	protected:
       
    86 		/**
       
    87 		* C++ default constructor.
       
    88 		*/
       
    89 		CUpnpCommand(CUpnpAVCPManager& aAVCPManager, 
       
    90 							CUpnpAVCPEngineSession& aSession, 
       
    91 							const RMessage2& aMessage);
       
    92 		/**
       
    93 		* Symbian 2nd phase constructor.
       
    94 		*/
       
    95 		void BaseConstructL();        
       
    96 		/**
       
    97 		* Read descriptor from message connected with this command
       
    98 		* @since Series 60 3.1
       
    99 		* @param aIndex index in message
       
   100 		* @return read value
       
   101 		*/
       
   102 		HBufC8* ReadDes8FromMessageLC(TInt aIndex);      
       
   103 		/**
       
   104 		* Read descriptor from message connected with this command
       
   105 		* @since Series 60 3.1
       
   106 		* @param aIndex index in message
       
   107 		* @return read value
       
   108 		*/		  
       
   109 		HBufC* ReadDes16FromMessageLC(TInt aIndex);
       
   110                 
       
   111 	protected:
       
   112     // session id used for registration in CUpnpAVCPManager    
       
   113 		TInt iSessionId;
       
   114 		// command id used for match with command requesting for results
       
   115 		TInt iId;
       
   116 		// type of request
       
   117 		TAVCPEngineRqst iType; 
       
   118     // AVCP manager used for sending request            
       
   119 		CUpnpAVCPManager& iAVCPManager;
       
   120 		// server-side session 
       
   121 		CUpnpAVCPEngineSession& iSession;
       
   122 		// processing message
       
   123 		RMessage2 iMessage;        
       
   124 	};
       
   125 
       
   126 #endif      // C_CUPNPCOMMAND_H 
       
   127             
       
   128 // End of File