×

Discussion Board

Results 1 to 15 of 73

Hybrid View

  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,689

    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
    Oct 2007
    Posts
    4

    Re: how to retrieve cellid from a mobile phone

    Hi Aloke I am also getting the same error when I am trying to compile the code. I am using Visual Studio 2005 with Carbide beta plug-in and Symbian SDK 8.1 and 9.1 both. This code is from newlc forum. B ut did you get any reply or working code. If so, can u please tell me how to create the project from scratch, because I am also stuck in my Final Year Project for over a week here. (Got atleast 10 diff non-working codes with me)
    I mean whether it is a Server-Client app or Console based app or Hello World App, then which header files and .cpp files do I need and where exactly do I need to copy-paste or put them...

    Could you please supply me with these details.
    Thanx in advance

    Quote Originally Posted by aloke View Post
    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

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

    Re: how to retrieve cellid from a mobile phone

    hi i realise this is a bit late relative to the last posting but i hope someone can help me. I tried both mobinfoapp_s60 and the helloworldbasic app on a nokia 6680 and the screen flashes and then nothing happens. I used carbide c++ 2.1 and s60 2nd ed fp2 to compile. Pls help...

  12. #12
    Nokia Developer Moderator
    Join Date
    Sep 2004
    Location
    Tampere, Finland
    Posts
    11,359

    Re: how to retrieve cellid from a mobile phone

    Have you been able to compile and run on device any of SDK's example applications?
    -- Lucian

    If you are not yet a DVLUP member it is time to correct that mistake :) Click here to join: http://www.dvlup.com/lucian/Invite

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

    Re: how to retrieve cellid from a mobile phone

    Yes, I managed to compile and run on the 6680 the shoppinglist application in s60_2nd_FP2_CW/series60ex/

    The helloworldbasic can compile without error, but the screen just flashes when I run it on device. The mobinfoapp_s60 app does the same thing.

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

    Re: how to retrieve cellid from a mobile phone

    Ok, I managed to get both to work by installing the mobinfo_Nokia app on the phone.

  15. #15
    Regular Contributor
    Join Date
    Jul 2008
    Posts
    97

    Question Re: how to retrieve cellid from a mobile phone

    Quote Originally Posted by strangehowthingsturnout View Post
    hi i realise this is a bit late relative to the last posting but i hope someone can help me. I tried both mobinfoapp_s60 and the helloworldbasic app on a nokia 6680 and the screen flashes and then nothing happens. I used carbide c++ 2.1 and s60 2nd ed fp2 to compile. Pls help...
    Hi,
    plz send me reply whn r u logged in. I am trying the same thing like u. I m using the mobinfo library/dll to get cell id n other network information forr 2nd edition fp2 phone (nokia 6630). I got some code as a zip helloworldbasic.zip which uses the mobinfo.h/mobinfotypes.h to get cell id for 2nd edition phones. i just imported the bld.inf file and built the sis file with THUMB build. then i transfered the sis file to phone and installed it. but whn i click on the helloworldbasic app icon on the phone, the screen just flashes n dosnot show any infomation. i also add the lib n dll of mobinfo in the sdk's folders. still the app does not run successfully on the phone..i cant find out what is the prblm exactly..

    remeber i m using mbinfo for 2nd edition phones n using carbide.c++ v1.2 as my IDE. what is the probable reason for this failure on phone..if u hav already found out the solution plz guide me..

    also the emulator build gives errors for the same helloworldbasic app but it builds success for THUMB build and ARMI build. m using S60 2nd edition fp2 sdk..

    plz tell em why should we use Active class while using the mobinfo apis? if i directly create an object of CMobileNetworkInfo class and call the GetCellId() method, can i fetch the cell id correctly? whats the prblm in doing that...in forum i found that to use mobinfo u should be familiar with Active objects.

    plz reply me inline n tell me how to attach the helloworldbasic.zip so that u can view the source which i m using...

    plz be patient and reply me. i hav wasted some days on this app development...

    thanks and regards,
    sanjay

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
  •  
×