Mobile 通过RIL层获取基站信息

xzfxzf_xzf 2010-12-01 10:32:06
大家好,我现在想在mobile上通过RIL层获取基站信息,得到其中的cid和lac字段。但是在初始化的时候报初始化错误,上网查了一下,说是需要签名。但是也有人说不需要签名。有高手帮我解答一下啊!

下面是我的初始化函数
RIL_Initialize( 1,NULL,NULL,RIL_NCLASS_ALL|RIL_NCLASS_DEVSPECIFIC,NULL,&m_hRil) )

本来第二个和第三个参数是两个回调函数的,我也写了。还是报初始化错误。现在换成NULL也是初始化错误
...全文
268 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
wn_aaron 2011-11-21
  • 打赏
  • 举报
回复
hRes = RIL_Initialize(1,
new RILRESULTCALLBACK(rilResultCallBack),
null,
0,
0,
out hRil);
jesperzx 2010-12-12
  • 打赏
  • 举报
回复
http://www.mymobiletrack.com/mobile/develop.php
zhushengjun1221 2010-12-04
  • 打赏
  • 举报
回复
楼上的有价值,收藏了
pcgpcgpcg 2010-12-03
  • 打赏
  • 举报
回复
我写过这个类,不过是c++,可以给你参考一下啊

#include "StdAfx.h"
#include "RILAgent.h"

HRESULT g_hCellTowerInfo;
HRIL g_RilHandle = NULL;

RILAgent::RILAgent(void)
{
}

RILAgent::~RILAgent(void)
{
}

RILAgent & RILAgent::GetInstance ()
{
static RILAgent agent;
static bool isInit = true;
if ( isInit )
{
isInit = false;
BOOL ret = agent.Init();
if (! ret )
{
//MessageBox(_T("failed to init ril"));
}
}
return agent;
}

BOOL RILAgent::Init()
{
HRESULT hr = S_FALSE;
BOOL bResult = FALSE;


hr = RILInitializeExt( );
g_hCellTowerInfo = RIL_GetCellTowerInfo(g_RilHandle);
// This function retrieves information about the cell tower
//currently used by the phone.
if ( g_hCellTowerInfo > 0 )
{
bResult = TRUE;
Sleep( 1000 );
}
else
{
bResult = FALSE;
}

Deinitialize();

return bResult;
}

HRESULT RILAgent::RILInitializeExt( void )
{
HRESULT hr = S_FALSE;
g_hCellTowerInfo = S_FALSE;
hr = RIL_Initialize(1,RILResultCallback,
RILNotifyCallback, RIL_NCLASS_ALL, DWORD(&m_BaseStationInfo), &g_RilHandle );

g_hCellTowerInfo = S_FALSE;
return hr;
}


void RILResultCallback(DWORD dwResultCode, HRESULT hrCommandID, const void* pData, DWORD dwDataSize, DWORD dwParam)
{
BaseStationInfo *basestationinfo=(BaseStationInfo*)dwParam;
HRESULT hr = RIL_RESULT_OK;
switch ( dwResultCode )
{
case RIL_RESULT_OK:
{
if ( hrCommandID == g_hCellTowerInfo )
{
g_hCellTowerInfo = RIL_GetCellTowerInfo(g_RilHandle);
RILCELLTOWERINFO *pCallInfo = ((RILCELLTOWERINFO *)pData);
// must call RIL_GetCellTowerInfo
DWORD dwCellID = pCallInfo->dwCellID;
DWORD dwLocationAreaCode = pCallInfo->dwLocationAreaCode;
DWORD dwMobileCountryCode = pCallInfo->dwMobileCountryCode;
DWORD dwMobileNetworkCode = pCallInfo->dwMobileNetworkCode;

(basestationinfo->m_CellID).Format(_T("%ld"),dwCellID);
(basestationinfo->m_LAC).Format(_T("%ld"),dwLocationAreaCode);
(basestationinfo->m_MCC).Format(_T("%ld"),dwMobileCountryCode);
(basestationinfo->m_MNC).Format(_T("%ld"),dwMobileNetworkCode);
// This structure stores cell tower information.

/*DWORD dwBaseStationID = pCallInfo->dwBaseStationID;
DWORD dwLocationAreaCode = pCallInfo->dwLocationAreaCode;
DWORD dwMobileCountryCode = pCallInfo->dwMobileCountryCode;
DWORD dwMobileNetworkCode = pCallInfo->dwMobileNetworkCode;
cout << "CellID : " << dwCellID << endl;
cout << "BaseStationID : " << dwBaseStationID << endl;
cout << "LAC : " << dwLocationAreaCode << endl;
cout << "MCC : " << dwMobileCountryCode << endl;
cout << "MNC : " << dwMobileNetworkCode << endl;*/

}
else
break;
}
default:
break;
}
return;
}

void RILNotifyCallback(
DWORD dwCode,
const void* lpData,
DWORD cbData,
DWORD dwParam)
{
HRESULT hr = RIL_RESULT_OK;
DEBUGMSG( TRUE, ( L"RILNotifyCallback,( 0x%x )\n", dwCode ) );
}

//deinitialize RIL
HRESULT RILAgent::Deinitialize( void )
{
HRESULT hr = S_FALSE;

hr = RIL_Deinitialize( &g_RilHandle );
if ( FAILED( hr ) )
{
DEBUGMSG(TRUE, (L"RIL_Deinitialize failed, hr = %x\r\n", hr));
}
g_RilHandle = NULL;

return hr;
}
我的送神 2010-12-01
  • 打赏
  • 举报
回复
RIL_Initialize( 1,NULL,NULL,RIL_NCLASS_ALL|RIL_NCLASS_DEVSPECIFIC,NULL,&m_hRil) )

看看你的参数对不对?
我的送神 2010-12-01
  • 打赏
  • 举报
回复
http://www.dotblogs.com.tw/kylin/archive/2009/08/09/9964.aspx
这里有例子,或许对你有用。。
ulovexd 2010-12-01
  • 打赏
  • 举报
回复
我靠,你的结贴率 高达0.00%
ulovexd 2010-12-01
  • 打赏
  • 举报
回复
先看下如何初始化成功吧,初始化都不行,其它肯定不行了,
初始化成功后,貌似 通过RIL_GetCellTowerInfo获取基站信息。
xzfxzf_xzf 2010-12-01
  • 打赏
  • 举报
回复
3楼那个例子我也看过 了 呵呵 我也知道流程 问题是现在初始化都不行 这让我很苦恼 呵呵
xzfxzf_xzf 2010-12-01
  • 打赏
  • 举报
回复
呵呵 参数应该没错吧 呵呵呵 看网上有人说需要签名有人说不需要签名 真不知道怎么做了 呵呵 大家赶紧指点指点 立马送分

7,655

社区成员

发帖
与我相关
我的任务
社区描述
Windows Phone是微软发布的一款手机操作系统,它将微软旗下的Xbox LIVE游戏、Zune音乐与独特的视频体验整合至手机中。
社区管理员
  • Windows客户端开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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