upnpframework/upnpcommand/inc/upnpcommand.h
changeset 0 7f85d04be362
child 38 5360b7ddc251
equal deleted inserted replaced
-1:000000000000 0:7f85d04be362
       
     1 /*
       
     2 * Copyright (c) 2008 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:  UpnpCommand plugin interface
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef UPNP_COMMAND_H
       
    20 #define UPNP_COMMAND_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <ecom/ecom.h>                       // REComSession
       
    24 #include <e32std.h>                     // RLibrary
       
    25 #include "upnpcommandcons.h"
       
    26 
       
    27 // FORWARD DECLARATION
       
    28 class MUpnpCommandCallback;
       
    29 
       
    30 // CONSTANTS
       
    31 
       
    32 
       
    33 // CLASS DEFINITION
       
    34 
       
    35 /**
       
    36 * UpnpCommand ECom plugin interface definition.
       
    37 */
       
    38 class CUpnpCommand : public CBase
       
    39     {
       
    40     public: // constructing / destructing
       
    41 
       
    42         /**
       
    43          * the DtorKey offset
       
    44          * to pass in REComSession::CreateImplementationL
       
    45          */
       
    46         static inline TInt32 DtorKeyOffset()
       
    47             {
       
    48             return _FOFF( CUpnpCommand, iDtor_ID_Key );
       
    49             }
       
    50 
       
    51         /**
       
    52          * Sets the command identity.
       
    53          *
       
    54          * @param aCommandId (UpnpCommand::TUpnpCommandId) the command ID
       
    55          */
       
    56         virtual void SetCommandIdL(
       
    57             UpnpCommand::TUpnpCommandId aCommandId ) = 0;
       
    58 
       
    59         /**
       
    60          * Sets the observer.
       
    61          *
       
    62          * @param aCallback The callback interface
       
    63          */
       
    64         virtual void SetObserver( MUpnpCommandCallback* aCallback ) = 0;
       
    65 
       
    66         /**
       
    67          * Destructor.
       
    68          */
       
    69         virtual ~CUpnpCommand();
       
    70 
       
    71     public: // Method for querying the availablity
       
    72 
       
    73         /**
       
    74          * Checks if this command is available for execution.
       
    75          *
       
    76          * @return ETrue if command is available and can be executed
       
    77          */
       
    78         virtual TBool IsAvailableL() = 0;
       
    79 
       
    80         /**
       
    81          * Checks if given command is available for execution.
       
    82          *
       
    83          * @param aCommandId (UpnpCommand::TUpnpCommandId) the command ID
       
    84          * @return ETrue if command is available and can be executed
       
    85          */
       
    86         virtual TBool IsAvailableL( UpnpCommand::TUpnpCommandId aCommandId ) = 0;
       
    87 
       
    88     public: // Business logic methods
       
    89 
       
    90         /**
       
    91          * Allocates the Upnp Framework resources.
       
    92          */
       
    93         virtual void AllocateResourcesL() = 0;
       
    94 
       
    95         /**
       
    96          * Releases the Upnp Framework resources. Stops command execution if
       
    97          * it is ongoing.
       
    98          */
       
    99         virtual void ReleaseResources() = 0;
       
   100 
       
   101         /**
       
   102          * Executes the command. If Upnp Framework resources are not yet
       
   103          * allocated, they are allocated.
       
   104          */
       
   105         virtual void ExecuteL() = 0;
       
   106 
       
   107         /**
       
   108          * Sets a parameter.
       
   109          *
       
   110          * Leaves if the given param type or value is not valid.
       
   111          *
       
   112          * @param aParamType parameter category
       
   113          * @param aParamValue (const TDesC&) parameter value
       
   114          */
       
   115         virtual void SetParameterL(
       
   116                                 UpnpCommand::TUpnpParameterType aParamType,
       
   117                                 const TDesC& aParamValue ) = 0;
       
   118 
       
   119         /**
       
   120          * Returns a parameter, either set by client or returned
       
   121          * as an out parameter after command execution
       
   122          *
       
   123          * @param aParamType (UpnpCommand::TUpnpParameterType)
       
   124          * @return value of the parameter
       
   125          */
       
   126         virtual const TDesC& Parameter(
       
   127             UpnpCommand::TUpnpParameterType aParamType ) = 0;
       
   128 
       
   129         /**
       
   130          * Resets all parameter values
       
   131          */
       
   132         virtual void ResetParameters() = 0;
       
   133 
       
   134         /**
       
   135          * Pushes one file into the file pipe.
       
   136          *
       
   137          * @param aParamvalue (const TDesC&) parameter value
       
   138          */
       
   139         virtual void PushFileL( const TDesC& aParam ) = 0;
       
   140 
       
   141         /**
       
   142          * number of files in the file pipe
       
   143          *
       
   144          * @return number of files in the pipe
       
   145          */
       
   146         virtual TInt FileCount() = 0;
       
   147 
       
   148         /**
       
   149          * Returns a file in the file pipe
       
   150          *
       
   151          * @param aIndex index of the file in pipe
       
   152          * @return the file reference
       
   153          */
       
   154         virtual const TDesC& File( TInt aIndex ) = 0;
       
   155 
       
   156         /**
       
   157          * Resets files in the file pipe
       
   158          */
       
   159         virtual void ResetFiles() = 0;
       
   160 
       
   161         /**
       
   162          * Returns the state of the command
       
   163          *
       
   164          * @return UpnpCommand::TUpnpCommandState the state
       
   165          */
       
   166         virtual UpnpCommand::TUpnpCommandState State() = 0;
       
   167 
       
   168     private: // Private data members
       
   169 
       
   170         /**
       
   171          * ECom instance identifier key.
       
   172          */
       
   173         TUid iDtor_ID_Key;
       
   174 
       
   175     };
       
   176 
       
   177 
       
   178 // --------------------------------------------------------------------------
       
   179 // Destructor.
       
   180 // --------------------------------------------------------------------------
       
   181 //
       
   182 inline CUpnpCommand::~CUpnpCommand()
       
   183     {
       
   184     REComSession::DestroyedImplementation( iDtor_ID_Key );
       
   185     }
       
   186 
       
   187 #endif // UPNP_COMMAND_H
       
   188 
       
   189 // End of File