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