maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   read cellID from N900 using python? (https://talk.maemo.org/showthread.php?t=37212)

synthaxx 2010-03-06 22:58

Re: read cellID from N900 using python?
 
I tried the example python file after adding python-location on my n900.

When i run it i get:

Code:

lat = 52.200000, long = 5.300000
quitting

every time i run it, which is not the correct location.

Anyone know what could be wrong?

happy_n900_user 2010-03-08 13:12

Re: read cellID from N900 using python?
 
I also had this problem, it seems that the sample code does not check if the GPS fix is real.

I have changed the line before print lat long to this:
if (device.fix[1] & location.GPS_DEVICE_LATLONG_SET) and not (device.status & location.GPS_DEVICE_STATUS_NO_FIX):

I haven't tested much after the change, but this seems to work better.

Search for GPS_DEVICE_STATUS_NO_FIX in http://wiki.maemo.org/PyMaemo/Using_Location_API

happy_n900_user 2010-03-08 19:53

Re: read cellID from N900 using python?
 
I tried the change on the bus home, and made one more addition to that line:
if (device.fix[1] & location.GPS_DEVICE_LATLONG_SET) and (device.fix[1] & location.GPS_DEVICE_TIME_SET) and not (device.status & location.GPS_DEVICE_STATUS_NO_FIX):

N.B: I don't know if these changes have negative effects on battery drain or something else. Try these changes at your own risk.

synthaxx 2010-03-09 15:59

Re: read cellID from N900 using python?
 
Works like a charm! Thanks!

It also seems to shutdown the GPS chipset after it's done.

The only issue is when it can't get a fix, you'll need to force quit.

tibrisch 2010-07-03 21:19

Re: read cellID from N900 using python?
 
Not sure if anyone cares... but i got cell_info with python like this:

Code:

import dbus

bus = dbus.SystemBus()
proxy = bus.get_object("com.nokia.phone.net","/com/nokia/phone/net",False)

cell_info = proxy.get_registration_status(dbus_interface="Phone.Net")

print cell_info



All times are GMT. The time now is 02:23.

vBulletin® Version 3.8.8