×

Discussion Board

Results 1 to 8 of 8

Thread: signal strength

  1. #1
    Registered User
    Join Date
    Feb 2008
    Posts
    5

    signal strength

    hai
    how can i get signalstrength in mobile
    please help me
    iam getting error in this code

    #include"battery.h"
    #include <aknnotewrappers.h>
    #include <etel3rdparty.h>
    #include <E32DES8.H>
    CBattery * CBattery::NewL()
    {
    CBattery *self= new(ELeave)CBattery();
    CleanupStack::PushL(self);
    self->ConstructL();
    CleanupStack::PopAndDestroy(self);
    return(self);
    }
    CBattery::CBattery():CActive(CActive::EPriorityStandard)
    {

    }
    void CBattery::ConstructL()
    {
    itelephony=CTelephony::NewL();
    CActiveScheduler::Add(this);
    User::LeaveIfError(iTimer.CreateLocal());
    }
    void CBattery::Getinfo()
    {
    itelephony->GetSignalStrength (aReqStatus, aSignalStrength);
    SetActive();
    }
    void CBattery::RunL()
    {
    // TBuf8<32>battery;

    //CAknInformationNote* informationNote1 = new (ELeave) CAknInformationNote;
    // informationNote1->ExecuteLD(aSignalStrength);
    }
    CBattery::~CBattery()
    {
    Cancel();
    iTimer.Close();
    }
    void CBattery:oCancel()
    {

    iTimer.Cancel();

    }

    TInt CBattery::RunError(TInt aError)
    {
    return KErrNone;

    }

  2. #2
    Nokia Developer Moderator
    Join Date
    Oct 2006
    Location
    Finland
    Posts
    4,563

    Re: signal strength

    Quote Originally Posted by venuc View Post
    hai
    how can i get signalstrength in mobile
    please help me
    iam getting error in this code

    #include"battery.h"
    #include <aknnotewrappers.h>
    #include <etel3rdparty.h>
    #include <E32DES8.H>
    CBattery * CBattery::NewL()
    {
    CBattery *self= new(ELeave)CBattery();
    CleanupStack::PushL(self);
    self->ConstructL();
    CleanupStack::PopAndDestroy(self);
    return(self);
    }
    CBattery::CBattery():CActive(CActive::EPriorityStandard)
    {

    }
    void CBattery::ConstructL()
    {
    itelephony=CTelephony::NewL();
    CActiveScheduler::Add(this);
    User::LeaveIfError(iTimer.CreateLocal());
    }
    void CBattery::Getinfo()
    {
    itelephony->GetSignalStrength (aReqStatus, aSignalStrength);
    SetActive();
    }
    void CBattery::RunL()
    {
    // TBuf8<32>battery;

    //CAknInformationNote* informationNote1 = new (ELeave) CAknInformationNote;
    // informationNote1->ExecuteLD(aSignalStrength);
    }
    CBattery::~CBattery()
    {
    Cancel();
    iTimer.Close();
    }
    void CBattery:oCancel()
    {

    iTimer.Cancel();

    }

    TInt CBattery::RunError(TInt aError)
    {
    return KErrNone;

    }
    I dont think you would get much help without mentioning what kind of error your are getting(and if you can even specify where..well that can be found by debugging your code)
    Note: use code tags when you are pasting your code in the thread..makes it more readable for someone who wants to help!!

  3. #3
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,347

    Smile Re: signal strength

    Quote Originally Posted by venuc View Post
    hai
    how can i get signalstrength in mobile
    please help me
    iam getting error in this code

    ...
    Perhaps this is what you are looking for: Monitoring signal strength with CTelephony

    Kiran.
    Nokia Developer Wiki Moderation team

  4. #4
    Regular Contributor
    Join Date
    Jan 2008
    Location
    Edinburgh, UK
    Posts
    100

    Re: signal strength

    Compile error or runtime error?

    I'm just a newbie, but in most code I've seen, the NewL function only has

    Code:
    CleanupStack::Pop(self);
    rather than
    Code:
    CleanupStack::PopAndDestroy(self);
    I think this makes a runtime error, as it will be returning a value that has been destroyed.

    ...or I could be wrong.

    Andy.
    Did I just say that out loud?

  5. #5
    Nokia Developer Champion
    Join Date
    Mar 2006
    Location
    Helsinki, Finland
    Posts
    8,347

    Re: signal strength

    Hi,

    I guess you are referring to Two phase construction. Read more about it here and you can also google it. Two-phase_construction

    Kiran.
    Nokia Developer Wiki Moderation team

  6. #6
    Super Contributor
    Join Date
    Jul 2006
    Location
    Oulu, Finland.
    Posts
    1,174

    Re: signal strength

    NewL is a factory method which returns newly created 'C' object, what is the meaning of this method if it destroys it.

    And why do you think there is a runtime error, function call to Pop removes the pointer from the cleanupstack, it does not destroy the object, infact PopAndDestory deletes the object.

  7. #7
    Regular Contributor
    Join Date
    Jan 2008
    Location
    Edinburgh, UK
    Posts
    100

    Re: signal strength

    Quote Originally Posted by vasant21 View Post
    NewL is a factory method which returns newly created 'C' object, what is the meaning of this method if it destroys it.

    And why do you think there is a runtime error, function call to Pop removes the pointer from the cleanupstack, it does not destroy the object, infact PopAndDestory deletes the object.
    I was referencing to the original post

    Quote Originally Posted by venuc View Post
    CBattery * CBattery::NewL()
    {
    CBattery *self= new(ELeave)CBattery();
    CleanupStack::PushL(self);
    self->ConstructL();
    CleanupStack::PopAndDestroy(self);
    return(self);
    }
    I think it should be changed from PopAndDestroy to Pop in order to prevent runtime error.

    Andy.
    Did I just say that out loud?

  8. #8
    Super Contributor
    Join Date
    Jul 2006
    Location
    Oulu, Finland.
    Posts
    1,174

    Re: signal strength

    ok, your word "rather than" confused me, i thought you are in favour of PopAndDestroy inside NewL.

Similar Threads

  1. Signal strength using RConnectionMonitor
    By masrivastava in forum Symbian Networking & Messaging (Closed)
    Replies: 9
    Last Post: 2009-03-24, 17:49
  2. Signal Strength Issues
    By mayankkedia in forum Symbian
    Replies: 10
    Last Post: 2008-01-04, 06:05
  3. Query: Signal Strength Values In Decibels
    By masrivastava in forum Symbian
    Replies: 0
    Last Post: 2006-04-11, 16:00
  4. Remote signal strength
    By Nokia_Archived in forum Nokia M2M
    Replies: 1
    Last Post: 2002-05-20, 15:34

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×