callcontinuity/vcchotrigger/inc/vccsignallevelhandler.h
branchRCL_3
changeset 21 f742655b05bf
parent 20 65a3ef1d5bd0
child 22 d38647835c2e
equal deleted inserted replaced
20:65a3ef1d5bd0 21:f742655b05bf
     1 /*
       
     2 * Copyright (c) 2008-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:   Base class for the signal level handling
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef VCCSIGNALLEVELHANDLER_H
       
    21 #define VCCSIGNALLEVELHANDLER_H
       
    22 
       
    23 #include <e32base.h>
       
    24 
       
    25 #include "vccsignallevelobserver.h"
       
    26 #include "vccunittesting.h"
       
    27 #include "vccsignallevelparams.h"
       
    28 
       
    29 /**
       
    30  *  Base class for signal level handling.
       
    31  *  Other classes are derived from this class.
       
    32  *
       
    33  *  @code
       
    34  *
       
    35  *  class CVccXXXSignalLevelHandler : public CVccSignalLevelHandler,
       
    36  *                                    public MXXXOtherClass
       
    37  *
       
    38  *  @endcode
       
    39  *
       
    40  *  @lib vcchotrigger.dll
       
    41  *  @since S60 v3.2
       
    42  */
       
    43 class CVccSignalLevelHandler : public CTimer
       
    44     {
       
    45 
       
    46 protected:
       
    47 
       
    48     /** Level of the signal */
       
    49     enum TStrengthState
       
    50         {
       
    51         EStrengthUnknown,
       
    52         EStrengthLow,
       
    53         EStrengthHigh
       
    54         };
       
    55 
       
    56     /** Current operation mode */
       
    57     enum TOperation
       
    58         {
       
    59         EOperationNone,
       
    60         EOperationGet,
       
    61         EOperationWait,
       
    62         EOperationComplete
       
    63         };
       
    64 
       
    65 public:
       
    66 
       
    67     /**
       
    68     * Destructor.
       
    69     */
       
    70     virtual ~CVccSignalLevelHandler();
       
    71 
       
    72     /**
       
    73      * Start signal level observing
       
    74      *
       
    75      * @since S60 3.2
       
    76      */
       
    77     void StartL();
       
    78 
       
    79     /**
       
    80      * Stop signal level observing
       
    81      *
       
    82      * @since S60 3.2
       
    83      */
       
    84     void Stop();
       
    85 
       
    86     /**
       
    87      * Set the notification parameters
       
    88      *
       
    89      * @since S60 3.2
       
    90      * @param aParams Notification parameters
       
    91      */
       
    92     virtual void SetParams( const TSignalLevelParams& aParams );
       
    93 
       
    94 protected:
       
    95 
       
    96     /**
       
    97      * C++ constructor
       
    98      *
       
    99      * @since S60 3.2
       
   100      * @param aObserver Observer to be notified when signal level changes
       
   101      * @param aParams Parameters at which level notifications should be given
       
   102      * as well the timeout how long the signal must at the specified level or
       
   103      * above before notification is given.
       
   104      */
       
   105     CVccSignalLevelHandler(
       
   106             MVccSignalLevelObserver& aObserver,
       
   107             const TSignalLevelParams& aParams );
       
   108 
       
   109     /**
       
   110      * Get the current Received Signal Strength Indicator (RSSI)
       
   111      *
       
   112      * @since S60 3.2
       
   113      */
       
   114     virtual void GetStrength() = 0;
       
   115 
       
   116     /**
       
   117      * Activate the notification service
       
   118      *
       
   119      * @since S60 3.2
       
   120      */
       
   121     virtual void EnableNotificationsL() = 0;
       
   122 
       
   123     /**
       
   124      * Cancel the notification service
       
   125      *
       
   126      * @since S60 3.2
       
   127      */
       
   128     virtual void DisableNotifications() = 0;
       
   129 
       
   130     /**
       
   131      * Cancel outstanding signal strentgh request.
       
   132      *
       
   133      * @since S60 3.2
       
   134      */
       
   135     virtual void CancelGetStrength() = 0;
       
   136 
       
   137     /**
       
   138      * Notifies the observer about signal level changes.
       
   139      *
       
   140      * @since S60 3.2
       
   141      * @param aRss RSS level in absolute dBm values
       
   142      * @param aRssClass specifies the current class of the received signal
       
   143      */
       
   144     virtual void NotifyChanges( TInt32 aSignalStrength,
       
   145          MVccSignalLevelObserver::TSignalStrengthClass aClass ) = 0;
       
   146 
       
   147     /**
       
   148      * Handles singal strength changes which are notified by the signal level observer
       
   149      *
       
   150      * @since S60 3.2
       
   151      */
       
   152     void StrengthChanged();
       
   153 
       
   154 // from base class CTimer
       
   155 
       
   156     /**
       
   157      * @see CTimer::ConstructL()
       
   158      */
       
   159     void ConstructL();
       
   160 
       
   161     /**
       
   162      * From CTimer::DoCancel()
       
   163      */
       
   164     void DoCancel();
       
   165 
       
   166 
       
   167 private:
       
   168 
       
   169 // from base class CActive
       
   170 
       
   171     /**
       
   172      * From CActive::RunL()
       
   173      */
       
   174     void RunL();
       
   175 
       
   176 
       
   177 protected: // data
       
   178 
       
   179     /**
       
   180      * Observer
       
   181      * Not own
       
   182      */
       
   183     MVccSignalLevelObserver& iObserver;
       
   184 
       
   185     /**
       
   186      * Parameters defining timers and signal levels
       
   187      */
       
   188     TSignalLevelParams iParams;
       
   189 
       
   190     /**
       
   191      * Current signal level in dBm
       
   192      */
       
   193     TInt32 iStrength;
       
   194 
       
   195     /**
       
   196      * Flag to determine if the observing/notifications are on or off
       
   197      */
       
   198     TBool iNotificationsOn;
       
   199 
       
   200     /* Current operation
       
   201     */
       
   202    TOperation iOperation;
       
   203 
       
   204      /* Current signal state
       
   205      */
       
   206     TStrengthState iState;
       
   207  
       
   208 
       
   209     VCC_UNITTEST( UT_CVccWlanSignalLevelHandler )
       
   210     VCC_UNITTEST( UT_CVccGsmSignalLevelHandler )
       
   211     };
       
   212 
       
   213 #endif // VCCSIGNALLEVELHANDLER_H