Nokia N97 SDK
Example Applications Guide

gmssignalmonitor.h

00001 /*
00002  ============================================================================
00003  Name           : GMSSignalMonitor.h
00004  Author   :
00005  Version         : 1.1
00006  Copyright   : This material, including documentation and any related computer
00007           programs, is protected by copyright controlled by Nokia Corporation.
00008  Description : CGMSSignalMonitor declaration
00009  ============================================================================
00010  */
00011 
00012 #ifndef GMSSIGNALMONITOR_H
00013 #define GMSSIGNALMONITOR_H
00014 
00015 #include <e32base.h>    // For CActive, link against: euser.lib
00016 #include <Etel3rdParty.h>
00017 #include "msignalobserver.h"
00018 
00019 /**
00020  * This class implements an active object (CActive) which registers with the
00021  * ETel 3rd Party API for receiving notifications when the network signal value
00022  * changes. Each network signal monitor has an associated observer which will
00023  * be notified of the change through the MSignalObserver interface. 
00024  */
00025 class CGMSSignalMonitor : public CActive
00026         {
00027 public:
00028         
00029         /**
00030          * Cancel the pending request and destroy the object
00031          */
00032         virtual ~CGMSSignalMonitor();
00033 
00034         /**
00035          * Two-phased constructor. 
00036          */
00037         static CGMSSignalMonitor* NewL(MSignalObserver& aObserver);
00038 
00039         /**
00040          * Two-phased constructor. Leaves constructed object on the
00041          * cleanup stack
00042          */
00043         static CGMSSignalMonitor* NewLC(MSignalObserver& aObserver);
00044 
00045 private:
00046         /**
00047          *  C++ constructor
00048          */
00049         CGMSSignalMonitor(MSignalObserver& aObserver);
00050 
00051         /**
00052          *  Second-phase constructor
00053          */
00054         void ConstructL();
00055 
00056         /**
00057          * Function for making the initial asynchronous request
00058          */
00059         void StartL();
00060         
00061 private:
00062         /**
00063          * From CActive. Handle completion of the current pending request
00064          */
00065         void RunL();
00066 
00067         /**
00068          * From CActive. Get's called when the current pending request is being
00069          * cancelled. 
00070          */
00071         void DoCancel();
00072 
00073         /**
00074          * From CActive. Override to handle leaves from RunL().
00075          * Ignores all errors but the active object remains innactive.
00076          */
00077         TInt RunError(TInt aError);
00078 
00079 private:
00080         /**
00081          * Pointer to ETel 3rd Party API's CTelephony
00082          */
00083         CTelephony *iTelephony; 
00084         
00085         /**
00086          * Instance of ETel 3rd Party API's TSignalStrengthV1
00087          */
00088         CTelephony::TSignalStrengthV1 iSignal;
00089 
00090         /**
00091          * Packaged instance of ETel 3rd Party API's TSignalStrengthV1
00092          */
00093         CTelephony::TSignalStrengthV1Pckg iPackage;
00094         
00095         /**
00096          * A MSignalObserver reference. Will be used to send signal change
00097          * notifications to the observer registered with this asynchronous
00098          * network signal monitor
00099          */
00100         MSignalObserver& iObserver;
00101         };
00102 
00103 #endif // GMSSIGNALMONITOR_H

© Nokia 2009

Back to top