![]() |
read cellID from N900 using python?
anyone have some python code which will allow me to pull the currently connected cell ID?
I want to be able to use this value to query an open cell database to get a rough location of the user (for when indoors/gps not working, etc) thanks. |
Re: read cellID from N900 using python?
http://talk.maemo.org/showthread.php?p=386188 showed how to do it in C. I know you requested for Python specifically, but I don't know python-dbus and I think python-osso won't help here, either, as the Cell ID is not the first thing returned...
|
Re: read cellID from N900 using python?
@hypnotik:
and here you have an example of using DBus in Python (this one is for WLAN scanning): http://slexy.org/view/s25h3to4Rr |
Re: read cellID from N900 using python?
Thanks qwerty12, hopbeat for the examples. I'll give a go.
|
Re: read cellID from N900 using python?
Quote:
I'm assuming I need to modify com.nokia.wlancond.signal to something else? EDIT: Ok, this is slowly starting to make sense now... qwerty12's post here shows the code for reading cellID. I just need to adapt it somehow to python. http://talk.maemo.org/showpost.php?p=385947&postcount=2 |
Re: read cellID from N900 using python?
Hmm.. I give up on this. Tried to adapt the code from qwerty12 into hopbeats' but I'm doing something wrong.
Code:
from dbus.glib import * All I get is: Code:
ERROR:dbus.proxies:Introspect error on :1.16:/com/nokia/phone/net: dbus.exceptions.DBusException: rpc.Error: object /com/nokia/phone/net doesn't have interface org.freedesktop.DBus.Introspectable |
Re: read cellID from N900 using python?
I wanted to try, python-dbus, I really did... But you turned out to be a piece of **** that can't do this correctly. So I cheated:
File.c: Code:
#include <glib.h> File.py: Code:
from ctypes import * |
Re: read cellID from N900 using python?
Not quite what hypnotik wants, but here's a script I'm using to log cell ID changes, hopefully it'll help:
Code:
#!/usr/bin/env python |
Re: read cellID from N900 using python?
Quote:
|
Re: read cellID from N900 using python?
Quote:
Daniel |
Re: read cellID from N900 using python?
@danielwilms, it's getting tricky when you want use gps and read cell id at the same time :)
|
Re: read cellID from N900 using python?
Quote:
|
Re: read cellID from N900 using python?
Quote:
|
Re: read cellID from N900 using python?
i tried Ima's script which worked nicely. however, in the information returned, can someone please tell me what is the cid and what is the lac? those two seems to have being returned as a single value...
|
Re: read cellID from N900 using python?
also, how would one make this something that's running in the background and just log everything to a file?
would something like screen work on the n900? could i just do python cid.py > logfile.log? |
Re: read cellID from N900 using python?
Quote:
http://wiki.maemo.org/PyMaemo/Using_Location_API Unfortunately the Cell ID information part is still not implemented in python-location (not the correct package name). PS: as a general tip, you can see Python related wiki pages by checking the Python category: http://wiki.maemo.org/Category:Python |
Re: read cellID from N900 using python?
lizardo
I have been looking at the location example you quoted above and get the following error. Quote:
|
Re: read cellID from N900 using python?
Quote:
|
Re: read cellID from N900 using python?
Quote:
http://wiki.maemo.org/PyMaemo/Using_...mplete_example |
Re: read cellID from N900 using python?
Hi Guy's
I have been checking out Lma's script from page1, it appear that when in 3G coverage args[2] shows the global cell id (unique with in network) this can be split in the following way to retrieve the RNC Id. Upper 12 bits RNC/ Lower 16 bits Cell i.e 52455502 001100100000 - 0110100001001110 800 - 26702 Also args[1] = LAC Hope this helps anyone working on this. |
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 Anyone know what could be wrong? |
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 |
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. |
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. |
Re: read cellID from N900 using python?
Not sure if anyone cares... but i got cell_info with python like this:
Code:
import dbus |
All times are GMT. The time now is 12:15. |
vBulletin® Version 3.8.8