vtprotocolsstub/inc/csessionhandler.h
changeset 0 ed9695c8bcbe
equal deleted inserted replaced
-1:000000000000 0:ed9695c8bcbe
       
     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:  Session command interface
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef CSESSIOHANDLER_H
       
    19 #define CSESSIOHANDLER_H
       
    20 NONSHARABLE_CLASS( TSessionHandler )
       
    21     {
       
    22     public:
       
    23         /**
       
    24          * Constructor.
       
    25          */
       
    26         TSessionHandler(MVtProtocolHandler* aProtocolHandler);
       
    27     private:
       
    28         MVtProtocolHandler* iProtocolHandler;
       
    29     };
       
    30 
       
    31 NONSHARABLE_CLASS( CSessionCommand ): public CBase,
       
    32                                       public MVtSessionCommand
       
    33     {
       
    34     public:
       
    35         /**
       
    36          * Contructor.
       
    37          */
       
    38         CSessionCommand(TSessionHandler* aSessionHandler);
       
    39         
       
    40         /**
       
    41          * Destructor.
       
    42          */
       
    43         ~CSessionCommand();
       
    44 
       
    45         /**
       
    46          * This function is valid only in the EIdle state.  It is a no-op when
       
    47          * invoked in any other state.  It causes the protocol to transition
       
    48          * to the ESetup state.  The terminal remains in the EInitializing state during
       
    49          * the transition.
       
    50          *
       
    51          *
       
    52          * @param aInitInfo
       
    53          *         A reference to a TVtInitInfo structure which set Mona on and off
       
    54          *         
       
    55          * @leave   This method can leave with one of the following error codes
       
    56          *          KErrNoMemory if the SDK failed to allocate memory during this operation
       
    57          * @returns A unique command id for asynchronous completion
       
    58          **/
       
    59         virtual TInt InitProtocolL(TVtInitInfo& aInitInfo);
       
    60 
       
    61         /**
       
    62          * For an incoming track (MVTVideoSink) this function  pauses sending
       
    63          * media to the sink (output device) and stops the sink.  It then does the protocol
       
    64          * negotiations with the remote terminal to pause the logical channel for
       
    65          * the specified track.
       
    66          *
       
    67          * For outgoing, it pauses the sending of media from the source and calls Stop() on the
       
    68          * source.  It also performs any necessary protocol negotiations with the remote terminal.
       
    69          * EVtCommandPause will be sent to the observer when the processing completes.
       
    70          *
       
    71          * @returns A unique command id for asynchronous completion
       
    72          **/
       
    73         virtual TInt PauseVideoL(MVTVideoSource& aDataSource);
       
    74         virtual TInt PauseVideoL(MVTVideoSink& aDataSink);
       
    75         virtual TInt PauseAudioL(MVTAudioSource& aAudioSource);
       
    76 
       
    77         /**
       
    78          * Resume a previously paused incoming or outgoing track.  For incoming,
       
    79          * this function starts resumes playing out the media to the appropriate
       
    80          * sink based on the current settings.  For outgoing it resumes encoding
       
    81          * and sending media from the source.
       
    82          *
       
    83          * EVtCommandResume will be invoked will be invoked on the observer when the processing completes.   
       
    84          *
       
    85          * @returns A unique command id for asynchronous completion
       
    86          **/
       
    87         virtual TInt ResumeVideoL(MVTVideoSource& aDataSource);
       
    88         virtual TInt ResumeVideoL(MVTVideoSink& aDataSink);
       
    89         virtual TInt ResumeAudioL(MVTAudioSource& aAudioSource);
       
    90 
       
    91         /**
       
    92          * This function is valid only in the ESetup and EInitializing state.  It is a
       
    93          * no-op when invoked in the EIdle state
       
    94          *
       
    95          * It causes the protocol to transition back to the EIdle state.  The
       
    96          * terminal remains in the EResetting state during the transition.
       
    97          *
       
    98          * While resetting, the protocol de-allocates all resources resources that
       
    99          * had been previously allocated.  When it completes, ResetComplete is called
       
   100          * and the protocol reverts to the EIdle state.
       
   101          *
       
   102          * @leave   This method can leave with one of the following error codes
       
   103          *          KErrNoMemory if the SDK failed to allocate memory during this operation
       
   104          * @returns A unique command id for asynchronous completion
       
   105          **/
       
   106         virtual TInt ResetProtocolL();
       
   107 
       
   108         /**
       
   109          * This function can be invoked only in the ESetup state.  The terminal starts connecting with the remote
       
   110          * terminal based on the specified options and capabilities.
       
   111          * The EVtCommandConnect command completion event will be passed to the observer
       
   112          * when connect completes.
       
   113          * Details about the negotiated session may be obtained by calling the GetSessionParamsL API.
       
   114          * GetSessionParamsL may be called after call setup is started to get the list of available channels
       
   115          * and their capabilities.
       
   116          * Incoming tracks may be opened before ConnectL completes and will be indicated via the
       
   117          * EVtIndicationIncommingTrack event.
       
   118          *
       
   119          * @param aComm
       
   120          *         An optional pointer to a comm server to provide comm source and sink end-points.
       
   121          * @returns A unique command id for asynchronous completion
       
   122          **/
       
   123         virtual TInt ConnectToProtocolL(MCommServer* aComm);
       
   124 
       
   125         /**
       
   126          * Allows an application to provide a media source to be associated with a logical channel
       
   127          * of communication with the peer.  Sources should be added after the EVtIndicationOutgoingTrack
       
   128          * indication is received for a newly established logical channel.  The media type and
       
   129          * channel id associated with the logical channel are specified as part of the indication.
       
   130          * This function accepts a MVtVideoSource which provides additional functionality
       
   131          * for advertizing capability and exposing configuration APIs.  
       
   132          * Data sources could be of the following types:
       
   133          * a)raw media sources like camera, microphone etc.
       
   134          * b)sources of compressed data like file, gateway component etc.
       
   135          *
       
   136          * @param aChannelId
       
   137          *          Indicates the channel id to be associated with this source.
       
   138          * @param aDataSource
       
   139          *          reference to the data source
       
   140          * @leave   This method can leave with one of the following error codes
       
   141          *          KErrNotSupported if the format of the sources/sinks is incomtible with what the SDK can handle
       
   142          *          KPVErrInvalidState if invoked in the incorrect state
       
   143          *          KErrNoMemory if the SDK failed to allocate memory during this operation
       
   144          * @return A unique command id for asynchronous completion
       
   145          */
       
   146         virtual TInt AddVideoSourceL(const TUint aChannelId, MVTVideoSource &aDataSource);
       
   147         virtual TInt AddAudioSourceL(const TUint aChannelId, MVTAudioSource &aDataSource);
       
   148 
       
   149         /**
       
   150          * Allows an application to provide a media sink for rendering an incoming media bitstream in a
       
   151          * logical channel of communication with the peer.
       
   152          * AddDataSinkL can be called only for established incoming logical channels identified by a unique
       
   153          * channel id.
       
   154          * Regular incoming channels are established by the peer and are
       
   155          * indicated using the EVtIndicationIncomingTrack indication.
       
   156          * This function takes in PV extension to MVtVideoSink or MVtAudioSink which provides additional functionality
       
   157          * for advertizing capability and exposing configuration APIs.  
       
   158          * EVtCommandAddDataSink event is sent to the observer on completion of this call.
       
   159          *
       
   160          * @param aChannelId
       
   161          *          Indicates the channel id to be associated with this sink.
       
   162          * @param aDataSink The data sink to be added
       
   163          *
       
   164          * @return A unique command id for asynchronous completion
       
   165          **/
       
   166         virtual TInt AddVideoSinkL(const TUint aChannelId, MVTVideoSink &aDataSink);
       
   167         virtual TInt AddAudioSinkL(const TUint aChannelId, MVTAudioSink &aDataSink);
       
   168 
       
   169         /**
       
   170          * This API is to allow the user to cancel all pending requests.  The current request being
       
   171          * processed, if any, will also be aborted.
       
   172          * EVtCommandCancelAllCommands will be passed to the command observer on completion.
       
   173          * @returns A unique command id for asynchronous completion
       
   174          **/
       
   175         virtual TInt CancelAllCommandsL( );
       
   176 
       
   177         /**
       
   178          * The Disconnect call is valid only when invoked in the EConnecting, and
       
   179          * EConnected states.  It causes the terminal to transition to the
       
   180          * EDisconnecting state.  All the media tracks both incoming and outgoing
       
   181          * will be closed on invoking Disconnect. On completion, the terminal
       
   182          * goes to the ESetup state.
       
   183          *
       
   184          * It is a no-op when called in any other state.
       
   185          *
       
   186          * This is an asynchronous request.  The EvtCommandDisconnect event will be
       
   187          * sent to the observer when the request processing is complete.  This
       
   188          * is the only event the Phone application should expect after calling
       
   189          * Disconnect.
       
   190          *
       
   191          * @returns A unique command id for asynchronous completion
       
   192          **/
       
   193         virtual TInt DisconnectFromProtocolL();
       
   194 
       
   195         /**
       
   196          * This API is to allow for extensibility of the protocol interface.
       
   197          * It allows a caller to ask for an instance of a particular interface object to be returned.
       
   198          * The mechanism is analogous to the COM IUnknown method.  The interfaces are identified with
       
   199          * an interface ID that is a UUID as in DCE and a pointer to the interface object is
       
   200          * returned if it is supported.  Otherwise the returned pointer is NULL.
       
   201          * @param aType
       
   202          * @param aProtocolCommand
       
   203          * @exception not_supported
       
   204          * leaves if the specified interface id is not supported.
       
   205          **/
       
   206         virtual TInt GetProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand*& aProtocolCommand);
       
   207 
       
   208         /**
       
   209          * This APIis to be used to release an interface that was previously obtained using
       
   210          * QueryInterfaceL.
       
   211          * @param aType
       
   212          * @param 
       
   213          * @exception not_supported
       
   214          * leaves if the specified interface id is not supported.
       
   215          **/
       
   216         virtual TInt DeleteProtocolInterfaceL(TVtConfigType aType, MVtProtocolCommand* aProtocolCommand); 
       
   217     private:
       
   218         CVideoSourceProxy* iVideoSource;
       
   219         CDisplaySinkProxy* iDisplaySink;
       
   220         TSessionHandler*   iSessionHandler;
       
   221     };
       
   222 #endif
       
   223 //  End of File