messagingapp/msgsettings/msginit/inc/cmobilesignalstrengthhandler.h
changeset 52 12db4185673b
equal deleted inserted replaced
44:36f374c67aa8 52:12db4185673b
       
     1 /*
       
     2 * Copyright (c) 2010 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:   Signal strength handler implementation over telephony API
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef MOBILESIGNALSTRENGTHHANDLER_H
       
    21 #define MOBILESIGNALSTRENGTHHANDLER_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <etelmm.h>
       
    26 #include "msignalstrengthhandler.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class MSignalStrengthObserver;
       
    30 
       
    31 // CLASS DECLARATION
       
    32 
       
    33 /**
       
    34 * Class implementing a signal strength handler over the telephony API
       
    35 */
       
    36 
       
    37 class CMobileSignalStrengthHandler : public CActive, public MSignalStrengthHandler
       
    38 {
       
    39     public:
       
    40         /**
       
    41          * Two-phased constructor.
       
    42          */
       
    43         static CMobileSignalStrengthHandler* NewL( );
       
    44 
       
    45         /**
       
    46          * Destructor.
       
    47          */
       
    48         ~CMobileSignalStrengthHandler();
       
    49 
       
    50     private:
       
    51         /**
       
    52          * C++ default constructor.
       
    53          */
       
    54         CMobileSignalStrengthHandler();
       
    55 
       
    56         /**
       
    57          * By default Symbian 2nd phase constructor is private.
       
    58          */
       
    59         void ConstructL();
       
    60 
       
    61     public: // from CActive
       
    62         /**
       
    63          * RunL
       
    64          */
       
    65         void RunL();
       
    66 
       
    67         /**
       
    68          * RunError
       
    69          * @param aError the error returned
       
    70          *  @return error
       
    71          */
       
    72         TInt RunError( TInt aError );
       
    73 
       
    74         /**
       
    75          * DoCancel
       
    76          */
       
    77         void DoCancel();
       
    78 
       
    79     public:
       
    80         /**
       
    81          * Returns ETrue if signal observing is supported, EFalse otherwise.
       
    82          * @return ETrue if signal observing is supported, EFalse otherwise.
       
    83          */
       
    84         TBool ObservingSupported();
       
    85         
       
    86         /**
       
    87          * Returns ETrue if signal strength requests are supported, EFalse otherwise.
       
    88          * @return ETrue if signal strength requests are supported, EFalse otherwise.
       
    89          */
       
    90         TBool RequestsSupported();
       
    91 
       
    92         /**
       
    93          * Sets the signal strength observer. May leave with KErrNotSupported
       
    94          * if signal strength observing is not supported.
       
    95          * @param aObserver Observer for signal strength. Ownership is not passed.
       
    96          */
       
    97         void SetSignalStrengthObserverL( MSignalStrengthObserver* aObserver );
       
    98 
       
    99         /**
       
   100          * Starts observing the signal strength. May leave with KErrNotSupported
       
   101          * if signal strength observing is not supported.
       
   102          */
       
   103         void StartObservingL();
       
   104  
       
   105         /**
       
   106          * Stops the signal strength observing.
       
   107          */
       
   108         void StopObservingL();
       
   109 
       
   110         /**
       
   111          * Returns the current signal strength. May leave with KErrNotSupported
       
   112          * if signal strength requests are not supported.
       
   113          * @return The current signal strength.
       
   114          */
       
   115         TInt SignalStrengthL();
       
   116         
       
   117         /**
       
   118          * Returns the current bar value. May leave with KErrNotSupported
       
   119          * if bar value requests are not supported.
       
   120          * @return The current signal strength.
       
   121          */
       
   122         TInt BarValueL();
       
   123 
       
   124     private: // New methods
       
   125 
       
   126         /**
       
   127          * Initializes server sessions.
       
   128          */
       
   129         void InitializeSessionsL();
       
   130         
       
   131         /**
       
   132          * Updates the current value of the signal strength.
       
   133          */
       
   134         void UpdateSignalStrengthL();
       
   135         
       
   136         /**
       
   137          * Notifiers observer about signal strength.
       
   138          */
       
   139         void NotifyObserver();
       
   140 
       
   141     private: 
       
   142     	/**
       
   143          * Pointer to signal strength observer, may be NULL. Also not owned by the instance.
       
   144          */
       
   145         MSignalStrengthObserver* iObserver;
       
   146         
       
   147         /**
       
   148          * State variable for observation.
       
   149          */
       
   150         TBool iObserving;
       
   151 
       
   152         /**
       
   153          * Current value of the signal strength.
       
   154          */
       
   155         TInt32 iSignalStrength;
       
   156         
       
   157         /**
       
   158          * Network bars value.
       
   159          */
       
   160         TInt8 iBars;
       
   161         
       
   162         /**
       
   163          * Mobile phone.
       
   164          */
       
   165         RMobilePhone iMobilePhone;
       
   166 
       
   167         /**
       
   168          * Telephony server session.
       
   169          */
       
   170         RTelServer iTelServer;
       
   171 };
       
   172 
       
   173 
       
   174 #endif // MOBILESIGNALSTRENGTHHANDLER_H
       
   175 
       
   176 // End of File