views:

3453

answers:

4

Tools/Env.: C++, VS2008, WM6.1

I currently only have the HTC Diamond Windows Mobile phone available for testing and try as I may, with all of my hacking prowess, I still cannot accomplish the task of acquiring the remaining details of Cell ID and LAC, to complete my cellular location based program.

I have managed to get the MCC and MNC, but the Cell ID and LAC numbers are still hidden to me. There must be a way of getting these, for the phone itself no doubt uses them for other things. :/

To reiterate what I have tried, it would be the following:

RIL_GetCellTowerInfo (g_hRIL);  // doesn't even signal the 'ResultCallback' function.

RIL_GetCurrentOperator (g_hRIL, RIL_OPFORMAT_NUM);  // calls the 'ResultCallback' function and only with this am I able to at least get the MCC and MNC.

Tried the following test code too, and nothing worked.

//constants and structures for cell ID
#define RIL_DEVSPECIFICPARAM_ENABLECELLIDSUPPORT 26
#define RIL_DEVSPECIFICPARAM_DISABLECELLIDSUPPORT 27

bool mode = true;
DWORD dwFuncID=0;

if (mode)
  dwFuncID = RIL_DEVSPECIFICPARAM_ENABLECELLIDSUPPORT;
else
  dwFuncID = RIL_DEVSPECIFICPARAM_DISABLECELLIDSUPPORT;

m_hrCellIdRequest_ = RIL_DevSpecific (g_hRIL,(LPBYTE) &dwFuncID, sizeof(DWORD));

//  no 'ResultCallback' triggered either.


BYTE req[4]= {24, 0, 0, 0};
m_hrCellIdRequest_ = RIL_DevSpecific (g_hRIL, req, 4);
req[0]=26;
m_hrCellIdRequest_ = RIL_DevSpecific (g_hRIL, req, 4);

I even tried sending the serial AT commands to get something back. eg. "AT+CCED=0\r" I only get a failed result of '4\r'.

I have read that the last option would be to read its internal memory. But that doesn't seem to be a general method that would work for other phones. And besides, I don't even know where to begin with that.

So I finally broke down with a plea for help to this fabulous community in that if you have somehow managed to get this information from this phone, can you please share it with us?

Or if it is impossible to get, can you explain in detail why that may be?

I just want closure of this once and for all. :)

+1  A: 

Check out the first answer here (I just tried it on an HTC Touch Diamond and it worked fine): msdn discussion board

hemisphire
That's only for MNC and MCC. I have those already.I need the Cell ID and LAC values now from the HTC Diamond. Did you manage to acquire those?
Sebastian Dwornik
No, it returns the rilcelltowerinfo structure, which has MNC, MCC, Cell ID, and LAC, among others.
hemisphire
This is weird then. Because I copied and pasted the entire code and I don't even get the ResultCallback(..) called.I have the HTC Diamond (CDMA version). Might yours be the GSM version? Don't know if that matters.
Sebastian Dwornik
+2  A: 

So after yet more digging around and stubborn "googling", it seems that the reason for the original RIL_* code not working on my phone is that I am on a CDMA (UMTS) network, and not a GSM network.

The GSM network, as I learned, provides the phone with values for MCC, MNC, Cell ID, and LAC.

The CDMA network on the other hand provides a different set of numbers, which are BID, NID, and SID.

e.g. CID -> BID, LAC -> NID, MNC -> SID, MCC -> MCC

The above RIL_* interface code is popular because there are more GSM phones/networks in the world than CDMA (North America mainly).

Now without a true GSM phone at hand, I cannot really test the RIL_* interface code I have. The WM6.1 SDK Cell Emulator tool is neat, but not enough to release a product with.

This then leaves me once again asking for any help from a mobile cellular expert regarding a way to retreive the BID, NID, and SID values from my HTC Diamond phone, in the hope that they really do translate to Cell ID and LAC.

Google Mobile Maps on my phone somehow manages to perform this spectacle. I can only guess they must have found a way on the CDMA network to get the cell tower info.

Any help is appreciated. :)

Sebastian Dwornik
CDMA doesn't have a concept of cells which is why you don't get that. This is an electronic radio property, not a software issue. Effectively your phone can be picked up on more than one antenna from the phone company, and use yet another set (1 or more) to transmit too, which is why CDMA's range is signficantly improved over GSM (we have CDMA networks in australia for the same reason). I guess they don't return the information as there is no equivalent in CDMA as such, you simply are in coverage or not.
Spence
Any idea how Google does it than?They could be using my mobile IP for geolocating too, but the location results seem way too precise from just an IP.
Sebastian Dwornik
A: 

Trade your CDMA phone in for a GSM version :)

Matthew Whited
+3  A: 

It looks like Google does indeed use your mobile IP for location, and has no support for CDMA: source

hemisphire
Yup, that did it. Thank you very much. :)
Sebastian Dwornik