natfw/natfwturnplugin/inc/tturnplugincallbackinfo.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2007 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 
       
    20 
       
    21 #ifndef T_TURNPLUGINCALLBACKINFO_H
       
    22 #define T_TURNPLUGINCALLBACKINFO_H
       
    23 
       
    24 // INCLUDES
       
    25 #include <e32base.h>
       
    26 #include "mnatfwpluginobserver.h"
       
    27 
       
    28 
       
    29 /**
       
    30  * This class contains the information to execute a single callback
       
    31  * function of MNATFWPluginObserver.
       
    32  */
       
    33 class TTurnPluginCallbackInfo
       
    34     {
       
    35 public: // Enumerations
       
    36 
       
    37         /**
       
    38          * One entry for each function of MNATFWPluginObserver, including all
       
    39          * the different TNATFWPluginEvent values. In addition error value,
       
    40          * for error notifications.
       
    41          */
       
    42         enum TFunction
       
    43             {
       
    44             EConnectServer,
       
    45             EActiveSending,
       
    46             EDeactiveSending,
       
    47             EActiveReceiving,
       
    48             EDeactiveReceiving,
       
    49             ELocalCandidateFound,
       
    50             EFetchingEnd,
       
    51             EError
       
    52             };
       
    53 
       
    54 public: // Constructors and destructor
       
    55 
       
    56     /**
       
    57      * Constructor
       
    58      *
       
    59      * @since   S60 3.2
       
    60      * @param   aTurnPlugin TURN Plug-in instance
       
    61      * @param   aObserver   TURN Plug-in observer
       
    62      * @param   aFunction Identifies the function of MNATFWPluginObserver
       
    63      *          to be called
       
    64      * @param   aStreamId stream ID
       
    65      * @param   aErrorCode Error reason
       
    66      * @param   aEventData Event data if any
       
    67      */
       
    68     TTurnPluginCallbackInfo( const CNATFWPluginApi& aTurnPlugin,
       
    69                              MNATFWPluginObserver& aObserver, 
       
    70                              TTurnPluginCallbackInfo::TFunction aFunction,
       
    71                              TUint aStreamId,
       
    72                              TInt aErrorCode,
       
    73                              TAny* aEventData );
       
    74 
       
    75     /**
       
    76      * Checks that the selected callback function has required parameters
       
    77      * defined and that no unrelevant parameters have been specified.
       
    78      *
       
    79      * @since   S60 3.2
       
    80      * @return  result of validation process as a boolean type
       
    81      */
       
    82     TBool Validate() const;
       
    83 
       
    84     /**
       
    85      * Calls a selected function of observer with the given parameters.
       
    86      * The function to call and the parameters were specified in the
       
    87      * constructor.
       
    88      *
       
    89      * @since   S60 v3.2
       
    90      */
       
    91     void Execute() const;
       
    92 
       
    93 private: // Constructors, for internal use
       
    94 
       
    95     TTurnPluginCallbackInfo();
       
    96 
       
    97     TTurnPluginCallbackInfo( const TTurnPluginCallbackInfo& aCallbackInfo );
       
    98 
       
    99 private: // New functions, for internal use
       
   100 
       
   101     /**
       
   102      * Passes events to observer
       
   103      *
       
   104      * @since   S60 3.2
       
   105      * @param   aEvent plug-in event
       
   106      */
       
   107     void PassEvent(
       
   108         MNATFWPluginObserver::TNATFWPluginEvent aEvent ) const;
       
   109 
       
   110     /**
       
   111      * Passes errors to observer
       
   112      *
       
   113      * @since   S60 v3.2
       
   114      */
       
   115     void PassError() const;
       
   116 
       
   117 public: // Data
       
   118 
       
   119     /**
       
   120      * Que link
       
   121      */
       
   122     TSglQueLink iLink;
       
   123 
       
   124     /**
       
   125      * TURN Plug-in reference
       
   126      */
       
   127     const CNATFWPluginApi& iTurnPlugin;
       
   128 
       
   129     /**
       
   130      * Observer for which to pass events
       
   131      */
       
   132     MNATFWPluginObserver& iObserver;
       
   133 
       
   134     /**
       
   135      * Selected callback function
       
   136      */
       
   137     TTurnPluginCallbackInfo::TFunction iFunction;
       
   138 
       
   139     /**
       
   140      * Stream ID
       
   141      */
       
   142     TUint iStreamId;
       
   143 
       
   144     /**
       
   145      * Error code
       
   146      */
       
   147     TInt iErrorCode;
       
   148 
       
   149     /**
       
   150      * The event data
       
   151      */
       
   152     TAny* iEventData;
       
   153     };
       
   154 
       
   155 #endif // T_TURNPLUGINCALLBACKINFO_H
       
   156