wlan_bearer/wlannwif/inc/NifWLMServerIf.h
changeset 0 c40eb8fe8501
child 10 0abc8c98be24
equal deleted inserted replaced
-1:000000000000 0:c40eb8fe8501
       
     1 /*
       
     2 * Copyright (c) 2002-2009 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 *    Defines class for interaction with WLMServer for Admission control purpose
       
    16 *
       
    17 */
       
    18 
       
    19 /*
       
    20 * %version: 8 %
       
    21 */
       
    22 
       
    23 #ifndef __NIFWLMSERVERIF_H__
       
    24 #define __NIFWLMSERVERIF_H__
       
    25 
       
    26 #include "WlanProto.h"
       
    27 #include "rwlmserver.h"
       
    28 
       
    29 /**
       
    30  * This class contains the information of a single access class
       
    31  * and includes methods for manipulating traffic streams of that
       
    32  * particular class. 
       
    33  */
       
    34 NONSHARABLE_CLASS( CLANNifWLMServerPerAC ) : public CActive
       
    35     {
       
    36 
       
    37 public:
       
    38 
       
    39     /**
       
    40      * Definitions for possible active object states.  
       
    41      */
       
    42     enum TActiveObjectContext
       
    43         {
       
    44         /** Traffic stream create request is ongoing. */
       
    45         ETSCreateRequest,
       
    46         /** Traffic stream inactivity timer is running. */
       
    47     	ETSDelTimer
       
    48         };
       
    49 
       
    50     /**
       
    51      * Factory method for creating an instance of CLANNifWLMServerPerAC.
       
    52      *
       
    53      * @param aAccessClass Access class definition for this instance.
       
    54      * @param aInactivityTime Inactivity time in microseconds after which
       
    55      *                        the current traffic stream will be deleted.
       
    56      * @param aIsAutomaticMgmt Whether automatic stream management is allowed.
       
    57      * @return Pointer to the created instance.
       
    58      */
       
    59     static CLANNifWLMServerPerAC* NewL(
       
    60         TWlmAccessClass aAccessClass,
       
    61         TUint aInactivityTime,
       
    62         TBool aIsAutomaticMgmt );
       
    63 
       
    64     /**
       
    65      * Destructor.
       
    66      */
       
    67     virtual ~CLANNifWLMServerPerAC();
       
    68 
       
    69     /**
       
    70      * Whether traffic is admitted on this access class.
       
    71      * 
       
    72      * @return ETrue if traffic is admitted, EFalse otherwise.
       
    73      */
       
    74     TBool IsAdmitted();
       
    75 
       
    76     /**
       
    77      * Set the traffic mode for this  access class.
       
    78      * 
       
    79      * @param aMode Traffic mode to set.
       
    80      */
       
    81     void SetTrafficMode(
       
    82         TWlmAcTrafficMode aMode );
       
    83 
       
    84     /**
       
    85      * Set the traffic status for this access class.
       
    86      *
       
    87      * @param aStatus Traffic status to set.
       
    88      */
       
    89     void SetTrafficStatus(
       
    90         TWlmAcTrafficStatus aStatus );
       
    91 
       
    92     /**
       
    93      * Suspend the inactivity timer.
       
    94      */
       
    95     void SuspendInactivityTimer();
       
    96 
       
    97     /**
       
    98      * Resume a suspended inactivity timer.
       
    99      */
       
   100     void ResumeInactivityTimer();    
       
   101 
       
   102     /**
       
   103      * Called by CLANLinkCommon when a packet is sent on this
       
   104      * particular access class.
       
   105      */
       
   106     void OnFrameSend();
       
   107 
       
   108     /**
       
   109      * Called by CLANLinkCommon when a packet has been received on this
       
   110      * particular access class.
       
   111      */
       
   112     void OnFrameReceive();
       
   113 
       
   114 protected: // From CActive
       
   115 	
       
   116     /**
       
   117      * From CActive.
       
   118      * Called by the active object framework when a request has been completed.
       
   119      */
       
   120 	void RunL();
       
   121 
       
   122     /**
       
   123      * From CActive.
       
   124      * Called by the framework if RunL leaves.
       
   125      *
       
   126      * @param aError The error code RunL leaved with.
       
   127      * @return KErrNone if leave was handled, one of the system-wide error codes otherwise.
       
   128      */
       
   129     TInt RunError(
       
   130         TInt aError );	
       
   131 
       
   132     /**
       
   133      * From CActive.
       
   134      * Called by the framework when Cancel() has been called.
       
   135      */
       
   136 	void DoCancel();
       
   137 
       
   138 private:
       
   139 
       
   140     /**
       
   141      * Constructor.
       
   142      */
       
   143     CLANNifWLMServerPerAC(
       
   144         TWlmAccessClass aAccessClass,
       
   145         TUint aInactivityTime,
       
   146         TBool aIsAutomaticMgmt );
       
   147 
       
   148     /**
       
   149      * Second phase constructor.
       
   150      */
       
   151     void ConstructL();
       
   152 
       
   153 private: // Data
       
   154 
       
   155 	/**
       
   156 	 * Handle to client API instance of WLAN Engine.
       
   157 	 */
       
   158 	RWLMServer iWlmServer;
       
   159 
       
   160 	/**
       
   161 	 * Contains the access class definition for this instance.
       
   162 	 */
       
   163 	const TWlmAccessClass iAccessClass;
       
   164 
       
   165 	/** 
       
   166 	 * Current traffic mode.
       
   167 	 */
       
   168 	TWlmAcTrafficMode iTrafficMode;
       
   169 
       
   170 	/**
       
   171 	 * Current traffic status.
       
   172 	 */
       
   173 	TWlmAcTrafficStatus iTrafficStatus;
       
   174 	 
       
   175 	/**
       
   176 	 * Current Active Object context.
       
   177 	 */
       
   178 	TActiveObjectContext iContext;
       
   179 
       
   180 	/**
       
   181 	 * Whether a traffic stream has been created.
       
   182 	 */
       
   183 	TBool iIsTsCreated;
       
   184 	   
       
   185     /**
       
   186      * ID of the current traffic stream.
       
   187      */
       
   188     TUint iTsId;
       
   189 
       
   190     /**
       
   191      * Traffic stream parameters.
       
   192      */
       
   193     TWlanTrafficStreamParameters iTsParams;
       
   194     
       
   195     /**
       
   196      * Status of the traffic stream.
       
   197      */
       
   198     TWlanTrafficStreamStatus iTsStatus;
       
   199     
       
   200     /** 
       
   201      * Inactivity time in microseconds after which the current traffic stream
       
   202      * will be deleted.
       
   203      */
       
   204     const TUint iTsInactivityTime;
       
   205 
       
   206 	/**
       
   207 	 * TS Deletion timer related variables.
       
   208 	 */
       
   209 	TTimeIntervalMicroSeconds32 iTsDelOrigTime;
       
   210 	TTimeIntervalMicroSeconds32 iTsDelRemainTime;
       
   211 	RTimer iTsDelTimer;
       
   212 	TTime iTsDelStartTime;
       
   213 
       
   214 	/**
       
   215 	 * Whether automatic stream management is allowed.
       
   216 	 */
       
   217 	TBool iIsAutomaticMgmt;
       
   218 
       
   219     };
       
   220 
       
   221 /**
       
   222  * This class implements the callback interface for
       
   223  * asynchronous notifications from WLAN engine.  
       
   224  */
       
   225 NONSHARABLE_CLASS ( CLANNifWLMServerCommon ) : public MWLMNotify
       
   226     {
       
   227 
       
   228 public:
       
   229 
       
   230     /**
       
   231      * Constructor.
       
   232      */
       
   233 	CLANNifWLMServerCommon(
       
   234 	    CLANLinkCommon *aLinkCommon );
       
   235 
       
   236     /**
       
   237      * Destructor.
       
   238      */
       
   239 	~CLANNifWLMServerCommon();
       
   240 
       
   241     /**
       
   242      * Second phase constructor.
       
   243      */
       
   244 	void ConstructL();
       
   245 
       
   246     /**
       
   247      * Get the current traffic status for access classes.
       
   248      * 
       
   249      * @param aArray Traffic status for access classes.
       
   250      * @return KErrNone if information is available, an error otherwise. 
       
   251      */
       
   252     TInt GetAcTrafficStatus(
       
   253         TWlmAcTrafficStatusArray& aArray );
       
   254 
       
   255 public:	// From MWLMNotify
       
   256 
       
   257     /**
       
   258      * From MWLMNotify.
       
   259      * The traffic mode of an access class has changed.
       
   260      *
       
   261      * @param aAccessClass Access class.
       
   262      * @param aMode Traffic mode of the access class.
       
   263      */
       
   264     void AccessClassTrafficModeChanged(
       
   265         TWlmAccessClass aAccessClass,
       
   266         TWlmAcTrafficMode aMode );
       
   267 
       
   268     /**
       
   269      * From MWLMNotify.
       
   270      * The traffic status of an access class has changed.
       
   271      *
       
   272      * @param aAccessClass Access class.
       
   273      * @param aStatus Traffic status of the access class.
       
   274      */
       
   275     void AccessClassTrafficStatusChanged(
       
   276         TWlmAccessClass aAccessClass,
       
   277         TWlmAcTrafficStatus aStatus );
       
   278 
       
   279 private: // Data
       
   280 
       
   281     /** Handle to CLANLinkCommon object. Not owned by this pointer. */
       
   282 	CLANLinkCommon* iLinkCommon;
       
   283 
       
   284 	/** Handle to client API instance of WLAN Engine. */
       
   285 	RWLMServer iWlmServer;
       
   286 
       
   287     };
       
   288 
       
   289 #endif //__NIFWLMSERVERIF_H__