Nokia N97 SDK
Example Applications Guide

CGMSSignalMonitor Class Reference

#include <gmssignalmonitor.h>

Inheritance diagram for CGMSSignalMonitor:

List of all members.

Detailed Description

This class implements an active object (CActive) which registers with the ETel 3rd Party API for receiving notifications when the network signal value changes. Each network signal monitor has an associated observer which will be notified of the change through the MSignalObserver interface.

Definition at line 25 of file gmssignalmonitor.h.


Public Member Functions

virtual  ~CGMSSignalMonitor ()

Static Public Member Functions

static CGMSSignalMonitor *  NewL (MSignalObserver &aObserver)
static CGMSSignalMonitor *  NewLC (MSignalObserver &aObserver)

Private Member Functions

  CGMSSignalMonitor (MSignalObserver &aObserver)
void  ConstructL ()
void  StartL ()
void  RunL ()
void  DoCancel ()
TInt  RunError (TInt aError)

Private Attributes

CTelephony *  iTelephony
CTelephony::TSignalStrengthV1  iSignal
CTelephony::TSignalStrengthV1Pckg  iPackage
MSignalObserver &  iObserver


Constructor & Destructor Documentation

CGMSSignalMonitor::~CGMSSignalMonitor (   )  [virtual]
 

Cancel the pending request and destroy the object

Definition at line 63 of file gmssignalmonitor.cpp.

References iTelephony.

00064         {
00065         Cancel(); // Cancel any request, if outstanding
00066         delete iTelephony;
00067         // Delete instance variables if any
00068         }

CGMSSignalMonitor::CGMSSignalMonitor (  MSignalObserver &  aObserver  )  [private]
 

C++ constructor

Definition at line 18 of file gmssignalmonitor.cpp.

Referenced by NewLC().

00018                                                                :
00019         CActive(EPriorityStandard), // Standard priority
00020         iPackage(iSignal),
00021         iObserver(aObserver)
00022         {
00023         }


Member Function Documentation

CGMSSignalMonitor * CGMSSignalMonitor::NewL (  MSignalObserver &  aObserver  )  [static]
 

Two-phased constructor.

Definition at line 41 of file gmssignalmonitor.cpp.

References NewLC().

Referenced by CHsSMWidgetExample::ConstructL().

00042         {
00043         CGMSSignalMonitor* self = CGMSSignalMonitor::NewLC(aObserver);
00044         CleanupStack::Pop(); // self;
00045         return self;
00046         }

CGMSSignalMonitor * CGMSSignalMonitor::NewLC (  MSignalObserver &  aObserver  )  [static]
 

Two-phased constructor. Leaves constructed object on the cleanup stack

Definition at line 29 of file gmssignalmonitor.cpp.

References CGMSSignalMonitor().

Referenced by NewL().

00030         {
00031         CGMSSignalMonitor* self = new (ELeave) CGMSSignalMonitor(aObserver);
00032         CleanupStack::PushL(self);
00033         self->ConstructL();
00034         return self;
00035         }

void CGMSSignalMonitor::ConstructL (   )  [private]
 

Second-phase constructor

Definition at line 52 of file gmssignalmonitor.cpp.

References iTelephony, and StartL().

00053         {
00054         iTelephony = CTelephony::NewL();
00055         CActiveScheduler::Add(this); // Add to scheduler
00056         StartL();
00057         }

void CGMSSignalMonitor::StartL (   )  [private]
 

Function for making the initial asynchronous request

Definition at line 84 of file gmssignalmonitor.cpp.

References iPackage, and iTelephony.

Referenced by ConstructL(), and RunL().

00085         {
00086         if(!IsActive())
00087                 {
00088                 iTelephony->NotifyChange(iStatus,
00089                         CTelephony::ESignalStrengthChange, iPackage);
00090                 SetActive(); // Tell scheduler a request is active
00091                 }
00092         }

void CGMSSignalMonitor::RunL (   )  [private]
 

From CActive. Handle completion of the current pending request

Definition at line 98 of file gmssignalmonitor.cpp.

References iObserver, iSignal, MSignalObserver::SignalLevelChangedL(), and StartL().

00099         {
00100         // leave in case the call completed with an error
00101         // this will cause the RunError method to be called with
00102         // CActive::iStatus' value as parameter
00103         User::LeaveIfError(iStatus.Int());
00104 
00105         // forward the info to the observer
00106         iObserver.SignalLevelChangedL(iSignal.iSignalStrength, iSignal.iBar);
00107 
00108         // re-start
00109         StartL();
00110         }

void CGMSSignalMonitor::DoCancel (   )  [private]
 

From CActive. Get's called when the current pending request is being cancelled.

Definition at line 75 of file gmssignalmonitor.cpp.

References iTelephony.

00076         {
00077         iTelephony->CancelAsync(CTelephony::ESignalStrengthChangeCancel);
00078         }

TInt CGMSSignalMonitor::RunError (  TInt  aError  )  [private]
 

From CActive. Override to handle leaves from RunL(). Ignores all errors but the active object remains innactive.

Definition at line 117 of file gmssignalmonitor.cpp.

00118         {
00119         return KErrNone; // aError;
00120         }


Member Data Documentation

CTelephony* CGMSSignalMonitor::iTelephony [private]
 

Pointer to ETel 3rd Party API's CTelephony

Definition at line 83 of file gmssignalmonitor.h.

Referenced by ConstructL(), DoCancel(), StartL(), and ~CGMSSignalMonitor().

CTelephony::TSignalStrengthV1 CGMSSignalMonitor::iSignal [private]
 

Instance of ETel 3rd Party API's TSignalStrengthV1

Definition at line 88 of file gmssignalmonitor.h.

Referenced by RunL().

CTelephony::TSignalStrengthV1Pckg CGMSSignalMonitor::iPackage [private]
 

Packaged instance of ETel 3rd Party API's TSignalStrengthV1

Definition at line 93 of file gmssignalmonitor.h.

Referenced by StartL().

MSignalObserver& CGMSSignalMonitor::iObserver [private]
 

A MSignalObserver reference. Will be used to send signal change notifications to the observer registered with this asynchronous network signal monitor

Definition at line 100 of file gmssignalmonitor.h.

Referenced by RunL().


The documentation for this class was generated from the following files:

© Nokia 2009

Back to top