获取手机CellID的问题

wangtige 2010-03-23 02:58:58
开发软件:Carbide.c++
语言:C++
版本:s60_3rd
来获得没有GPS功能的手机的CellID,有源代码的别藏着,发出来共同研究。
...全文
464 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
viatech_bj 2010-06-22
  • 打赏
  • 举报
回复
学习了,顶!
iamsorry198609 2010-03-26
  • 打赏
  • 举报
回复
好。。学习前辈。
alidion 2010-03-26
  • 打赏
  • 举报
回复
来晚了,就是顶一下
Defonds 2010-03-24
  • 打赏
  • 举报
回复
对头,symbian 给接口了。
bsr2009 2010-03-23
  • 打赏
  • 举报
回复
来晚了,试一下LS两位的代码,呵呵。
漁_夫 2010-03-23
  • 打赏
  • 举报
回复
Telephony = CTelephony::NewL();
iTelephony->NotifyChange(iStatus,CTelephony::ECurrentNetworkInfoChange,iNetworkInfoV1Pckg);

利用活动对象实现就好了。。很简单。。。
  • 打赏
  • 举报
回复
#ifndef __NETWORKINFO_H__
#define __NETWORKINFO_H__
#include <etel3rdparty.h>
// CTelephony
// Observer interface

enum
{
EGetCell, EGetsigal
};

class MNetworkInfoObserver
{
public:
virtual void NetworkInfoRetrievedL(
const CTelephony::TNetworkInfoV1& aNetworkInfo) = 0;
virtual void HandleNetworkInfoError(TInt aError) = 0;

virtual void NetworkSigalStrengthL(
const CTelephony::TSignalStrengthV1& aSigalStrengthPckg) = 0;
virtual void HandleSigalStrengthError(TInt aError) = 0;

};
// Active object to get network info
class CNetworkInfo : public CActive
{
public:
static CNetworkInfo* NewL();
~CNetworkInfo();
void GetNetworkInfoL(MNetworkInfoObserver* aObserver);
void GetSigalStrengthL(MNetworkInfoObserver* aObserver);
protected:
// from CActive
void RunL();
TInt RunError(TInt aError);
void DoCancel();
private:
CNetworkInfo();
void ConstructL();
private:
CTelephony* iTelephony;
CTelephony::TNetworkInfoV1 iNwInfo;
CTelephony::TNetworkInfoV1Pckg iNwInfoPckg;
CTelephony::TSignalStrengthV1 iSsInfo;
CTelephony::TSignalStrengthV1Pckg iSigalStrengthPckg;
MNetworkInfoObserver* iObserver;
TInt iTask;
};
#endif // __NETWORKINFO_H__



/*
* NetworkInfo.cpp
*
* Created on: 2009-12-29
* Author: Administrator
*/

#include "NetworkInfo.h"

CNetworkInfo::CNetworkInfo() :
CActive(EPriorityStandard), iNwInfoPckg(iNwInfo),iSigalStrengthPckg(iSsInfo)
{
CActiveScheduler::Add(this);
}
CNetworkInfo* CNetworkInfo::NewL()
{
CNetworkInfo* self = new (ELeave) CNetworkInfo;
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop();
return self;
}
void CNetworkInfo::ConstructL()
{
iTelephony = CTelephony::NewL();
}
CNetworkInfo::~CNetworkInfo()
{
Cancel();
delete iTelephony;
}
// This function is used by our class' users to start getting network info.
void CNetworkInfo::GetNetworkInfoL(MNetworkInfoObserver* aObserver)
{
__ASSERT_ALWAYS(!IsActive(), User::Leave(KErrInUse));
iObserver = aObserver;
// Start async call to receive current network information
iTelephony->GetCurrentNetworkInfo(iStatus, iNwInfoPckg);
iTask = EGetCell;
SetActive();
}

// This function is used by our class' users to start getting network info.
void CNetworkInfo::GetSigalStrengthL(MNetworkInfoObserver* aObserver)
{
__ASSERT_ALWAYS(!IsActive(), User::Leave(KErrInUse));
iObserver = aObserver;
// Start async call to receive current network information
iTelephony->GetSignalStrength(iStatus, iSigalStrengthPckg);
iTask = EGetsigal;
SetActive();
}

void CNetworkInfo::DoCancel()
{
iTelephony->CancelAsync(CTelephony::EGetCurrentNetworkInfoCancel);
}
void CNetworkInfo::RunL()
{
User::LeaveIfError(iStatus.Int());
// Request completed successfully.
// Now we can notify our observer.
switch (iTask)
{
case EGetCell:
{
if (iObserver)
{
iObserver->NetworkInfoRetrievedL(iNwInfoPckg());
}
break;
}
case EGetsigal:
{
if (iObserver)
{
iObserver->NetworkSigalStrengthL(iSigalStrengthPckg());
}
break;
}
default:
break;
}

}
TInt CNetworkInfo::RunError(TInt aError)
{
// There was an error retrieving current network info.
// Let's inform our observer about the error so that it can analyze it
// and try to recover.
if (iObserver)
{
iObserver->HandleNetworkInfoError(aError);
}
return KErrNone;
}

3,119

社区成员

发帖
与我相关
我的任务
社区描述
塞班系统(Symbian系统)是塞班公司为手机而设计的操作系统,它的前身是英国宝意昂公司的 EP ( Electronic Piece of cheese)操作系统。
社区管理员
  • Symbian社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧