wlan_bearer/wlanldd/wlan_common/umac_common/inc/umaceventdispatcher.h
changeset 0 c40eb8fe8501
equal deleted inserted replaced
-1:000000000000 0:c40eb8fe8501
       
     1 /*
       
     2 * Copyright (c) 2005-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 the License "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:   Declaration of the WlanEventDispatcher class.
       
    15 *
       
    16 */
       
    17 
       
    18 /*
       
    19 * %version: 17 %
       
    20 */
       
    21 
       
    22 #ifndef WLANEVENTDISPATCHER_H
       
    23 #define WLANEVENTDISPATCHER_H
       
    24 
       
    25 #ifndef RD_WLAN_DDK
       
    26 #include <wha.h>
       
    27 #else
       
    28 #include <wlanwha.h>
       
    29 #endif
       
    30 
       
    31 #include "umacoidmsg.h"
       
    32 
       
    33 #include "umac_types.h"
       
    34 
       
    35 class WlanContextImpl;
       
    36 class MWlanEventDispatcherClient;
       
    37 
       
    38 /**
       
    39  *  Event dispatcher which is used to serialize MAC prototocl
       
    40  *  statemachine access.
       
    41  *
       
    42  *  @lib wlanumac.lib
       
    43  *  @since S60 v3.1
       
    44  */
       
    45 class WlanEventDispatcher
       
    46     {
       
    47 
       
    48 public:
       
    49 
       
    50     /**  channel identifier type */
       
    51     typedef TUint32 TChannel;
       
    52 
       
    53     /**  oid channel identifier */
       
    54     static const TChannel KOidChannel = ( 1 << 0 );
       
    55 
       
    56     explicit WlanEventDispatcher( 
       
    57         MWlanEventDispatcherClient& aEventDispatcherClient );
       
    58         
       
    59     inline ~WlanEventDispatcher();
       
    60 
       
    61     /**
       
    62      * Registers a WHA command completion event
       
    63      *
       
    64      * @since S60 3.1
       
    65      * @param aCompleteCommandId ID of the WHA command
       
    66      * @param aStatus Command completion status
       
    67      * @param aCommandCompletionParams Command completion output parameters
       
    68      */
       
    69     void Register( 
       
    70         WHA::TCompleteCommandId aCompleteCommandId,
       
    71         WHA::TStatus aStatus,
       
    72         const WHA::UCommandCompletionParams& aCommandCompletionParams );
       
    73 
       
    74     /**
       
    75      * Registers a WLAN Mgmt Client command
       
    76      *
       
    77      * @since S60 3.1
       
    78      * @param aOid Command parameters
       
    79      */
       
    80     inline void Register( const TOIDHeader& aOid );
       
    81 
       
    82     /**
       
    83      * Registers an internal UMAC event (triggered by an external event)
       
    84      *
       
    85      * @since S60 3.1
       
    86      * @param aInternalEvent Event to register
       
    87      */
       
    88     inline void Register( TInternalEvent aInternalEvent );
       
    89 
       
    90     /**
       
    91      * Enables the specified event dispatching channels
       
    92      *
       
    93      * @since S60 3.1
       
    94      * @param aChannelMask Mask of the channels to enable
       
    95      */
       
    96     inline void Enable( TChannel aChannelMask );
       
    97 
       
    98     /**
       
    99      * Disables the specified event dispatching channels
       
   100      *
       
   101      * @since S60 3.1
       
   102      * @param aChannelMask Mask of the channels to disable
       
   103      */
       
   104     inline void Disable( TChannel aChannelMask );
       
   105 
       
   106     /**
       
   107      * Determines if specified even dispatching channel(s) is (are) enabled
       
   108      *
       
   109      * @since S60 3.1
       
   110      * @param aChannel The channel(s) to check
       
   111      * @return ETrue if the channel(s) is (are) enabled
       
   112      *         EFalse otherwise
       
   113      */
       
   114     inline TBool ChannelEnabled( TChannel aChannel ) const;
       
   115 
       
   116     /**
       
   117      * Dispatches a single event, if there are any registered
       
   118      *
       
   119      * @since S60 3.1
       
   120      * @return ETrue If a global state change occurred because of the event
       
   121      *               dispatching
       
   122      *         EFalse otherwise
       
   123      */
       
   124     TBool Dispatch();
       
   125 
       
   126     /**
       
   127      * Dispatches a single command completion event
       
   128      *
       
   129      * @since S60 3.1
       
   130      * @return ETrue If a global state change occurred as a result of the event
       
   131      *               dispatching
       
   132      *         EFalse otherwise
       
   133      */
       
   134     TBool DispatchCommandCompletionEvent();
       
   135 
       
   136     /**
       
   137      * Determines if a command completion event for the specified 
       
   138      * command is registered
       
   139      *
       
   140      * @param aCommandId Id of the command to check
       
   141      * @return ETrue if command completion event is registered
       
   142      *         EFalse otherwise
       
   143      */
       
   144     inline TBool CommandCompletionRegistered( 
       
   145         WHA::TCompleteCommandId aCommandId ) const;
       
   146     
       
   147 private:
       
   148 
       
   149     /**
       
   150      * Dispatches a single internal event
       
   151      *
       
   152      * @since S60 3.1
       
   153      * @return ETrue If a global state change occurred because of the event
       
   154      *               dispatching
       
   155      *         EFalse otherwise
       
   156      */
       
   157     TBool DispatchInternalEvent();
       
   158     
       
   159     /**
       
   160      * Dispatches a single WLAN Mgmt Client command event
       
   161      *
       
   162      * @since S60 3.1
       
   163      * @return ETrue If a global state change occurred because of the event
       
   164      *               dispatching
       
   165      *         EFalse otherwise
       
   166      */
       
   167     TBool DispatchOidEvent();
       
   168 
       
   169     // Prohibit copy constructor.
       
   170     WlanEventDispatcher( const WlanEventDispatcher& );
       
   171     // Prohibit assigment operator.
       
   172     WlanEventDispatcher& operator= ( const WlanEventDispatcher& );
       
   173 
       
   174 private: // data
       
   175 
       
   176     MWlanEventDispatcherClient& iEventDispatcherClient;
       
   177 
       
   178     struct TCommandResp
       
   179         {
       
   180         WHA::TCompleteCommandId iId;
       
   181         WHA::TStatus iStatus;
       
   182         WHA::UCommandCompletionParams iParams;
       
   183         
       
   184         inline TCommandResp();            
       
   185         };
       
   186 
       
   187     /**
       
   188      * stores WHA command completion output parameters
       
   189      */
       
   190     TCommandResp                iWhaCommandCompletionParams;
       
   191 
       
   192     /**
       
   193      * True, if a command completion event has been registed.
       
   194      * At most one command completion event can exist at a time
       
   195      */
       
   196     TBool                       iCommandCompletionRegistered;
       
   197 
       
   198     /**
       
   199      * bit mask specifying the event dispatching channels which are currently
       
   200      * disabled (if any)
       
   201      */
       
   202     TChannel                    iDisableChannelMask;
       
   203     
       
   204     /**
       
   205      * pointer to the structure holding the WLAN Mgmt Client command 
       
   206      * parameters. NULL if a command event is not registered
       
   207      * Not own.
       
   208      */
       
   209     const TOIDHeader*           iOid;
       
   210 
       
   211     /**
       
   212      * bitmask for registered internal events
       
   213      */
       
   214     TInternalEvent              iInternalEvents;
       
   215 
       
   216     };
       
   217 
       
   218 #include "umaceventdispatcher.inl"
       
   219 
       
   220 #endif // WLANEVENTDISPATCHER_H