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