×

Discussion Board

Page 1 of 5 12345 LastLast
Results 1 to 15 of 73
  1. #1
    Registered User
    Join Date
    Feb 2007
    Posts
    8

    how to retrieve cellid from a mobile phone

    hi,
    i am final year student doing my project on Location Based System .
    basically we retrieve the cell id and put it onto a map.
    we have got some sample codes with us but when we compile it we encounter with lots of compilation errors.

    There are 2 files
    1. cellid.cpp
    2. System Manager.

    CELLID.CPP

    // System includes
    #include <badesca.h>
    #include <e32std.h>
    #include <eikenv.h>
    #include <eikappui.h>
    #include <eikapp.h>
    #include <etelbgsm.h>

    //User includes
    #include "SystemManager.h"

    CSystemManager* CSystemManager::NewL()
    {
    CSystemManager* self = new (ELeave) CSystemManager();
    CleanupStack::PushL(self);
    self->ConstructL();
    CleanupStack::Pop(self);

    return self;
    }

    CSystemManager::CSystemManager() : CActive(EPriorityHigh), // HIGH priority
    iPhoneInfoType(EHandsetIMEI),
    iState(EStart),
    iTelephony(NULL),
    iIMEI(0),
    iIMSI(0),
    iCellId(0),
    iLocationAreaCode(0)
    {

    }

    void CSystemManager::ConstructL()
    {
    iTelephony = CTelephony::NewL();
    CActiveScheduler::Add(this); // Add to scheduler
    }

    CSystemManager::~CSystemManager()
    {
    Cancel(); // Cancel any request, if outstanding
    // Delete instance variables if any
    delete iTelephony;
    }

    void CSystemManagerCancel()
    {
    switch(iPhoneInfoType)
    {
    case EHandsetIMEI:
    iTelephony->CancelAsync(CTelephony::EGetPhoneIdCancel);
    break;
    case EHandsetIMSI:
    iTelephony->CancelAsync(CTelephony::EGetSubscriberIdCancel);
    break;
    default:
    iTelephony->CancelAsync(CTelephony::EGetCurrentNetworkInfoCancel);
    break;
    }
    }

    void CSystemManager::StartL()
    {
    Cancel(); // Cancel any request, just to be sure
    iState = EGetPhoneInfo;
    switch(iPhoneInfoType)
    {
    case EHandsetIMEI:
    {
    CTelephony::TPhoneIdV1Pckg phoneIdPckg( iPhoneId );
    iTelephony->GetPhoneId(iStatus, phoneIdPckg);
    }
    break;
    case EHandsetIMSI:
    {
    CTelephony::TSubscriberIdV1Pckg subscriberIdPckg( iSubscriberId );
    iTelephony->GetSubscriberId(iStatus, subscriberIdPckg);
    }
    break;
    case EHandsetNetworkInfo:
    {
    CTelephony::TNetworkInfoV1Pckg networkInfoPckg( iNetworkInfo );
    iTelephony->GetCurrentNetworkInfo(iStatus, networkInfoPckg);
    }
    break;
    }

    SetActive(); // Tell scheduler a request is active
    iActiveSchedulerWait.Start();
    }

    void CSystemManager::RunL()
    {
    iState = EDone;
    if ( iActiveSchedulerWait.IsStarted() )
    {
    iActiveSchedulerWait.AsyncStop();
    if(iStatus == KErrNone)
    {
    switch(iPhoneInfoType)
    {
    case EHandsetIMEI:
    iIMEI.Append(iPhoneId.iSerialNumber );
    break;
    case EHandsetIMSI:
    iIMSI.Append(iSubscriberId.iSubscriberId );
    break;
    case EHandsetNetworkInfo:
    iCellId = iNetworkInfo.iCellId;
    iLocationAreaCode = iNetworkInfo.iLocationAreaCode;
    break;
    }
    }
    else
    {
    // ***********Handle Error here ************
    }
    }
    }

    const TPtrC CSystemManager::GetIMEI()
    {
    iPhoneInfoType = EHandsetIMEI;
    iIMEI.Zero();

    StartL();
    TPtrC ptr(iIMEI.Ptr());
    return ptr;
    }

    const TPtrC CSystemManager::GetIMSI()
    {
    iPhoneInfoType = EHandsetIMSI;
    iIMSI.Zero();

    StartL();
    TPtrC ptr(iIMSI.Ptr());
    return ptr;
    }

    void CSystemManager::GetNetworkInfoL(TUint& aLocationCode, TUint& aCellId)
    {
    iPhoneInfoType = EHandsetNetworkInfo;
    StartL();
    aCellId = iCellId;
    aLocationCode = iLocationAreaCode;

    return;

    }



    SYSTEM MANAGER

    #ifndef __SYSTEM_MANAGER_H__
    #define __SYSTEM_MANAGER_H__

    #include <Etel3rdParty.h>

    class CystemManager : public CActive
    {
    public:
    typedef enum {EHandsetIMEI, EHandsetIMSI, EHandsetNetworkInfo } InfoType;

    public:
    static CystemManager* NewL();

    // Destructor
    ~CSystemManager();

    public:
    // New functions
    void StartL(); // Request

    const TPtrC GetIMEI();
    const TPtrC GetIMSI();
    void GetNetworkInfoL(TUint& aLocation, TUint& aCellId);

    private:
    // C++ constructor
    CSystemManager();
    // Second-phase constructor
    void ConstructL();



    // From CActive
    void RunL();

    // Cancel
    void DoCancel();

    private:
    enum TGetInfoState
    {
    EStart = 1,
    EGetPhoneInfo,
    EDone
    };

    private:
    InfoType iPhoneInfoType;
    TInt iState; // State of the active object
    CTelephony* iTelephony;

    CTelephony::TPhoneIdV1 iPhoneId;
    CTelephony::TSubscriberIdV1 iSubscriberId;
    CTelephony::TNetworkInfoV1 iNetworkInfo;

    CActiveSchedulerWait iActiveSchedulerWait;
    TBuf<CTelephony::KPhoneSerialNumberSize>iIMEI;
    TBuf<CTelephony::KIMSISize> iIMSI;
    TUint iCellId;
    TUint iLocationAreaCode;
    };
    #endif // __SYSTEM_MANAGER_H__


    The required header files in this are etelbsm.h which we alredy have ...

    thank you
    Reply With Quote

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,675

    Re: how to retrieve cellid from a mobile phone

    There are a number of threads about getting the GSM Cell Id. The proper way also depends on the SDK you use, and you have not named one.
    Use the search facility anyway.

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

    Re: how to retrieve cellid from a mobile phone

    If you want to retrieve cellid for 2nd edition, go thru the post:
    http://discussion.forum.nokia.com/fo...ad.php?t=19693

    if you want to do this for 3rd edition phones you can use CTelephony.

  4. #4
    Regular Contributor
    Join Date
    Dec 2006
    Location
    pune
    Posts
    76

    Smile Re: how to retrieve cellid from a mobile phone

    hi ,
    this is another way to retrive cell id.

    it help u to give the cell id .

    Code:
    void CGetimeiexContainer::GetImei(TDes &aImei)
    {
    #ifndef __WINS__
    	RTelServer*	ts=new RTelServer;
    	ts->Connect();
    	RTelServer::TPhoneInfo pi;
    	ts->GetPhoneInfo(0,pi);
    
    	RBasicGsmPhone*	ph=new RBasicGsmPhone;
    	ph->Open(*ts,pi.iName);
    	ph->Initialise();
    		
    	RBasicGsmPhone::TId id;
    	ph->GetGsmPhoneId(id);
    	
    	aImei=id.iSerialNumber;
    	
    	delete ph;
    	
    	ts->Close();
    	delete ts;
    #else
    	aImei=_L("1234567890ABCDEF");
    #endif
    
    }

  5. #5
    Regular Contributor
    Join Date
    Dec 2006
    Location
    pune
    Posts
    76

    Thumbs up Re: how to retrieve cellid from a mobile phone

    hi ,

    this link is also help to give cell id.
    http://discussion.forum.nokia.com/fo...ad.php?t=19693

  6. #6
    Registered User
    Join Date
    Feb 2007
    Posts
    8

    Re: how to retrieve cellid from a mobile phone

    hi ,
    actually i went through the sites u suggested .but the problem is that in the code we have some thing called Ctelephony which is not defines in our SDK .
    And also the SDK we use is 6.1 and 7.0 for series 60 phones.
    we have downloaded the file called Mobinfo 3rd Party Telephone Line whic contains functions to get the cell id and all.
    but the problem is that the classes defined in mobinfo can be used on UIQ phones only.

    can u guys recommend me any solution.

    the basic aim of my project is to retrieve the cellid of the base station and use it to put it on a local map ..in short to make a Location Based System using the help of the cellid ..

  7. #7
    Regular Contributor
    Join Date
    Sep 2006
    Posts
    280

    Re: how to retrieve cellid from a mobile phone

    Quote Originally Posted by aloke
    hi ,
    we have downloaded the file called Mobinfo 3rd Party Telephone Line whic contains functions to get the cell id and all.
    MobInfo API can be used even in S60 Phones.
    I have used them and they work perfectly fine.

    Regards.

  8. #8
    Registered User
    Join Date
    Feb 2007
    Posts
    8

    Re: how to retrieve cellid from a mobile phone

    hi tina,
    the thing is that in my code as mentioned in the earlier post we have something called Ctelephony which is only available in later versions of Symbian OS ..
    the Ctelephony class is not available in series 60 phone SDK therefore everythting changes.

    we haveto download the later version of the SDK.. or is there any other method to get round this problem.

    thanx

  9. #9
    Regular Contributor
    Join Date
    Sep 2006
    Posts
    280

    Re: how to retrieve cellid from a mobile phone

    Hi Aloke,

    Sorry for the delayed response.
    CTelephony is only available for S60 3rd Edition.
    If you want to use CTelephony you need to download the
    3rd Edition SDK.

    You can use MobInfo API for 2nd Edition if you want
    to retrieve the cell id information.

    Regards.

  10. #10
    Registered User
    Join Date
    Feb 2007
    Posts
    8

    Re: how to retrieve cellid from a mobile phone

    sorry for such a delay it thaught people had stop reading my post...
    the thing is i have got a sample code called mobinfo test from a site.
    the thing is that the code is written for UIQ thats is ericsson phones..
    what i have done is changed all the Cqik to Eik ...

    now the problem i face is in the .mmp file there is a file called qikctl.lib which is for UIQ. whenever i remove this lib and upudate the .mno file it comes back ......

    THIS THE SITE FROM WHERE I FOUND THE CODE....
    http://developer.sonyericsson.com/si...y_to_reach.jsp

  11. #11
    Regular Contributor
    Join Date
    Sep 2006
    Posts
    280

    Re: how to retrieve cellid from a mobile phone

    This is the example of MobInfo Api usage in S60.
    http://symbianos.org/~andreh/HelloWorld.zip

  12. #12
    Registered User
    Join Date
    Feb 2007
    Posts
    8

    Re: how to retrieve cellid from a mobile phone

    hi tina ,
    i am actually a noobie to symbian c++. trying to learn it on my own as far as possible.
    downloaded the hello world program u gave. the thing is that in the .RSS file there is pane which has the following contents:


    RESOURCE MENU_PANE r_example_first_menu
    {
    items=
    {
    MENU_ITEM { command=ECancelRequestUI; txt="CANCEL Request"; },
    MENU_ITEM { command=EGetIMSIUI; txt="EGetIMSI"; },
    MENU_ITEM { command=EGetIMEIUI; txt="EGetIMEI"; },
    MENU_ITEM { command=EGetOwnNumberUI; txt="EGetOwnNumber"; },
    MENU_ITEM { command=EGetCurrentNetworkUI; txt="EGetCurrentNetwork"; },
    MENU_ITEM { command=EGetHomeNetworkUI; txt="EGetHomeNetwork"; },
    MENU_ITEM { command=EGetCellIdUI; txt="EGetCellId"; },
    MENU_ITEM { command=ENotifyCellIdChangeUI; txt="ENotifyCellIdChange"; },
    MENU_ITEM { command=EGetNetworkAvailabilityUI;txt="EGetNetworkAvailability"; },
    MENU_ITEM { command=ENotifyNetworkAvailabilityChangeUI; txt="ENotifyNetworkAvailabilityChange"; },
    MENU_ITEM { command=EGetBatteryChargeLevelUI; txt="EGetBatteryChargeLevel"; },
    MENU_ITEM { command=ENotifyBatteryLevelChangeUI; txt="ENotifyBatteryLevelChange"; },
    MENU_ITEM { command=EGetSignalStrengthLevelUI; txt="EGetSignalStrengthLevel"; },
    MENU_ITEM { command=ENotifySignalStrengthLevelChangeUI; txt="ENotifySignalStrengthLevelChange"; },
    MENU_ITEM { command=EEikCmdExit; txt="Close"; }
    };
    }


    i am reffered the addison wesley book and in that they had written that MENU_PANE provides a various item in the menu list .
    but i couldnt see any list like that.

    and moreover why does the helloworld program requires cmobinfo.cpp file??..

    thanx
    bye!!!!!!!!!!!!

  13. #13
    Regular Contributor
    Join Date
    Sep 2006
    Posts
    280

    Re: how to retrieve cellid from a mobile phone

    Hi Alok,

    The function CMobInfo::IssueRequest(TMobInfoRequest aRequest)
    in cmobinfo.cpp is the function which does the placing of requests for
    retreiving the IMEI and stuff.

    Adn actually there was some problem with this code because of which the menu
    Options on LHS didnt appear.

    You can integrate the mobinfo.h and mobinfo.cpp in your and use them like they are used in AppUi.cpp.

    I presently dont have the modified code.

    Hope this makes sense to you.

    Regards.

  14. #14
    Regular Contributor
    Join Date
    Sep 2006
    Posts
    280

    Re: how to retrieve cellid from a mobile phone

    Hi,

    Attached is the working example using MobInfo API.
    It will write the values into a file mobinfo.txt in c:\
    I went through your code and found out that you are not familiar
    with the Active Objects Framework.
    I would suggest you to go through the active object framework before proceeding.

    If you still face problems feel free to ask.

    Regards,
    Tina
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    Feb 2007
    Posts
    8

    Re: how to retrieve cellid from a mobile phone

    i dunno how to send attchamnets over the forums!!!!!!

Similar Threads

  1. Connecting PC to Mobile Phone Via Bluetooth
    By Sapinou in forum Bluetooth Technology
    Replies: 3
    Last Post: 2011-04-13, 08:19
  2. Nokia Image Converter
    By davidpurdie in forum General Development Questions
    Replies: 0
    Last Post: 2004-02-18, 15:31

Posting Permissions

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