获取基站
获取基站求助
CTelephony GetCurrentNetworkInfo 获取基站信息,为什么除了取出aCountryCode=460外其它的值如Cellid一直不成功.能力也应该给了
代码如下:
.h
#ifndef MYTELEPHONY_H
#define MYTELEPHONY_H
#include <e32base.h>
#include <Etel3rdParty.h>
class CMyTelephony : public CActive
{
public:
static void GetIMSIL(TDes& aIMSI);
static void GetIMEIL(TDes& aIMEI);
static void GetPhoneType(TDes& aPhoneType);
static void GetNetworkInfo(TDes& aCountryCode, TDes& aNetworkId, TUint aLocationAreaCode, TUint aCellId);
//static void GetNetworkInfo(TUint aLocationAreaCode, TUint aCellId);
static void DialPhone(const TDesC& aPhoneId);
static CMyTelephony* NewL();
protected:
void DoCancel();
void RunL();
private:
static CMyTelephony* NewLC();
~CMyTelephony();
CMyTelephony();
void ConstructL();
void GetSubscriberId();
void GetCurrentNetworkInfo();
void GetPhoneId();
private:
CTelephony* iTelephony;
CTelephony::TCancellationRequest iRequest;
CTelephony::TSubscriberIdV1 iSubscriberId;
CTelephony::TSubscriberIdV1Pckg iSubscriberIdPckg;
CTelephony::TPhoneIdV1 iPhoneId;
CTelephony::TPhoneIdV1Pckg iPhoneIdPckg;
CTelephony::TCallId iCallId;
TBuf<32> iPhoneType;
CTelephony::TNetworkInfoV1 iNetworkInfoV1;
CTelephony::TNetworkInfoV1Pckg iNetworkInfoV1Pckg;
//RTimer iTimer; // Provides async timing service
public :
void DialNewCall(const TDesC& aTelNumber);
};
#endif // MYTELEPHONY_H
.cpp:
// MyTelephony.cpp
//
#include <e32svr.h>
#include "MyTelephony.h"
#include <f32file.h>
//class CTelephony;
CMyTelephony* CMyTelephony::NewLC()
{
CMyTelephony* self = new (ELeave) CMyTelephony;
CleanupStack::PushL(self);
self->ConstructL();
return self;
}
CMyTelephony* CMyTelephony::NewL()
{
CMyTelephony* self = CMyTelephony::NewLC();
CleanupStack::Pop(self);
return self;
}
void CMyTelephony::GetIMSIL(TDes& aIMSI)
{
CMyTelephony* telephony = CMyTelephony::NewL();
telephony->GetSubscriberId();
aIMSI = telephony->iSubscriberId.iSubscriberId;
delete telephony;
}
void CMyTelephony::GetIMEIL(TDes& aIMEI)
{
CMyTelephony* telephony = CMyTelephony::NewL();
telephony->GetPhoneId();
aIMEI = telephony->iPhoneId.iSerialNumber;
delete telephony;
}
void CMyTelephony::GetPhoneType(TDes& aPhoneType)
{
CMyTelephony* telephony = CMyTelephony::NewL();
telephony->GetPhoneId();
aPhoneType.Copy(telephony->iPhoneId.iManufacturer);
aPhoneType.Append(telephony->iPhoneId.iModel);
delete telephony;
}
void CMyTelephony::GetNetworkInfo(TDes& aCountryCode, TDes& aNetworkId, TUint aLocationAreaCode, TUint aCellId)
//void CMyTelephony::GetNetworkInfo(TUint aLocationAreaCode, TUint aCellId)
{
CMyTelephony* telephony = CMyTelephony::NewL();
telephony->GetCurrentNetworkInfo();
CTelephony GetCurrentNetworkInfo 获取基站信息,为什么除了取出aCountryCode=460外其它的值如Cellid一直不成功.能力也应该给了
代码如下:
.h
#ifndef MYTELEPHONY_H
#define MYTELEPHONY_H
#include <e32base.h>
#include <Etel3rdParty.h>
class CMyTelephony : public CActive
{
public:
static void GetIMSIL(TDes& aIMSI);
static void GetIMEIL(TDes& aIMEI);
static void GetPhoneType(TDes& aPhoneType);
static void GetNetworkInfo(TDes& aCountryCode, TDes& aNetworkId, TUint aLocationAreaCode, TUint aCellId);
//static void GetNetworkInfo(TUint aLocationAreaCode, TUint aCellId);
static void DialPhone(const TDesC& aPhoneId);
static CMyTelephony* NewL();
protected:
void DoCancel();
void RunL();
private:
static CMyTelephony* NewLC();
~CMyTelephony();
CMyTelephony();
void ConstructL();
void GetSubscriberId();
void GetCurrentNetworkInfo();
void GetPhoneId();
private:
CTelephony* iTelephony;
CTelephony::TCancellationRequest iRequest;
CTelephony::TSubscriberIdV1 iSubscriberId;
CTelephony::TSubscriberIdV1Pckg iSubscriberIdPckg;
CTelephony::TPhoneIdV1 iPhoneId;
CTelephony::TPhoneIdV1Pckg iPhoneIdPckg;
CTelephony::TCallId iCallId;
TBuf<32> iPhoneType;
CTelephony::TNetworkInfoV1 iNetworkInfoV1;
CTelephony::TNetworkInfoV1Pckg iNetworkInfoV1Pckg;
//RTimer iTimer; // Provides async timing service
public :
void DialNewCall(const TDesC& aTelNumber);
};
#endif // MYTELEPHONY_H
.cpp:
// MyTelephony.cpp
//
#include <e32svr.h>
#include "MyTelephony.h"
#include <f32file.h>
//class CTelephony;
CMyTelephony* CMyTelephony::NewLC()
{
CMyTelephony* self = new (ELeave) CMyTelephony;
CleanupStack::PushL(self);
self->ConstructL();
return self;
}
CMyTelephony* CMyTelephony::NewL()
{
CMyTelephony* self = CMyTelephony::NewLC();
CleanupStack::Pop(self);
return self;
}
void CMyTelephony::GetIMSIL(TDes& aIMSI)
{
CMyTelephony* telephony = CMyTelephony::NewL();
telephony->GetSubscriberId();
aIMSI = telephony->iSubscriberId.iSubscriberId;
delete telephony;
}
void CMyTelephony::GetIMEIL(TDes& aIMEI)
{
CMyTelephony* telephony = CMyTelephony::NewL();
telephony->GetPhoneId();
aIMEI = telephony->iPhoneId.iSerialNumber;
delete telephony;
}
void CMyTelephony::GetPhoneType(TDes& aPhoneType)
{
CMyTelephony* telephony = CMyTelephony::NewL();
telephony->GetPhoneId();
aPhoneType.Copy(telephony->iPhoneId.iManufacturer);
aPhoneType.Append(telephony->iPhoneId.iModel);
delete telephony;
}
void CMyTelephony::GetNetworkInfo(TDes& aCountryCode, TDes& aNetworkId, TUint aLocationAreaCode, TUint aCellId)
//void CMyTelephony::GetNetworkInfo(TUint aLocationAreaCode, TUint aCellId)
{
CMyTelephony* telephony = CMyTelephony::NewL();
telephony->GetCurrentNetworkInfo();