Active Topics

 


Reply
Thread Tools
Posts: 155 | Thanked: 69 times | Joined on Apr 2008
#1
I'm attaching my python code to access the GPS. It is a thin wrapper around the Maemo 4.x liblocation API described here:
http://maemo.org/development/documen....html#Location

I am running an n810 with the latest OS 2008 firmware and was not able to make the python-gpsbt module work as advertised. I decided to wrap the official location API using ctypes instead. The example usage script should "just work" to turn on your GPS and start printing location data once it locks.

This code "works for me", but should be considered alpha since I am the only one who has used it. Eventually I'll try releasing this someplace better. The example is placed in the public domain and the wrapper is licensed under LGPL v3.

The files should be renamed to *.py after downloading.
Attached Files
File Type: txt gpsexample.txt (2.0 KB, 1423 views)
File Type: txt liblocation.txt (7.8 KB, 1225 views)
 

The Following 7 Users Say Thank You to rbrewer123 For This Useful Post:
Posts: 5 | Thanked: 0 times | Joined on Apr 2008
#2
Thank you so much for your python wrapper. It's very useful for me.
I've detected a really weird error:
When I load your liblocation from console applications or graphic applications everything works well. But if I try to load it from some "hildon desktop home plugin" (aka widget) I get the error:
File "/usr/lib/hildon-desktop/gps_N800.py", line 1, in <module>
import liblocation
ImportError: dynamic module does not define init function (initliblocation)

I don't have any Idea about how to fix it. It doesn't have any senseˇ
 
Posts: 5 | Thanked: 0 times | Joined on Apr 2008
#3
I reply myself:
Adding
Code:
def __init__():
    pass
It works.
I should read better the error messages. Sometimes are useful.
 
Posts: 486 | Thanked: 154 times | Joined on Sep 2009 @ New York City
#4
Any thoughts on getting this working for N900? I'm trying to build a cool location-based social network leveaging an existing site's API, but I'm not finding any information on how to connect to the built in location based services of the N900 (either through internal GPS or the cell-triangulation?). I tried using your examples but no dice.

Much appreciated.
 
hopbeat's Avatar
Posts: 516 | Thanked: 643 times | Joined on Oct 2009 @ Denmark/Poland
#5
@hypnotik, are you focused on Python, or can you use c/c++ ?
__________________
Hi! I'm a Maemo Greeter!
Witaj na talk.maemo.org!

Useful links for newcomers:
Użyteczne linki:
Nowi użyktownicy mówią cześć | New members say hello , Tu zaczynają nowi użytkownicy | New users start here, Podforum społeczności | Community subforum, Wiki dla początkujących | Beginners' wiki page, Maemo5 101, Często zadawane pytania | Frequently Asked Questions (FAQ), Google

Jeżeli mogę w czymś pomóc, pytaj!
If I can help with anything else, just ask!

Bored? Follow me
 
Posts: 486 | Thanked: 154 times | Joined on Sep 2009 @ New York City
#6
Originally Posted by hopbeat View Post
@hypnotik, are you focused on Python, or can you use c/c++ ?
Well, considering I'm coming from a web-dev background and that I know Python, yeah, I don't have the wherewithal to learn c/c++ (gives me a headache - pointers, memory management and what not).

I don't understand why there isn't something out there already as an example, esp if there is this push for PyQt to get rapid development on the N900.

I've already started building a PyQt based app for the N900... but not being able to read gps info from the phone is a critical stumbing block.
 
yerga's Avatar
Posts: 696 | Thanked: 1,012 times | Joined on Mar 2006 @ Asturies, Spain
#7
The GPS module is being worked by the Pymaemo guys. They have something in the SVN and they will be pushing a package to the repository soon enough.

http://wiki.maemo.org/PyMaemo/Using_Location_API
https://bugs.maemo.org/show_bug.cgi?id=5748#c2
__________________
Daniel Martín Yerga
maemo.org profile
Twitter
 

The Following User Says Thank You to yerga For This Useful Post:
hopbeat's Avatar
Posts: 516 | Thanked: 643 times | Joined on Oct 2009 @ Denmark/Poland
#8
I asked, because we have a beta sensors library for c++. For GPS you just create an object of a receiver and then you have access to the coordinates. But yeah, c++ is not as good for development as python (although not so bad as you could imagine, especially with Qt).
__________________
Hi! I'm a Maemo Greeter!
Witaj na talk.maemo.org!

Useful links for newcomers:
Użyteczne linki:
Nowi użyktownicy mówią cześć | New members say hello , Tu zaczynają nowi użytkownicy | New users start here, Podforum społeczności | Community subforum, Wiki dla początkujących | Beginners' wiki page, Maemo5 101, Często zadawane pytania | Frequently Asked Questions (FAQ), Google

Jeżeli mogę w czymś pomóc, pytaj!
If I can help with anything else, just ask!

Bored? Follow me
 
Posts: 24 | Thanked: 38 times | Joined on Nov 2009
#9
hopbeat: Where can I find out more about the C++ library?
 
hopbeat's Avatar
Posts: 516 | Thanked: 643 times | Joined on Oct 2009 @ Denmark/Poland
#10
@sjaensch, PM me, as it is not yet ready for public tests
__________________
Hi! I'm a Maemo Greeter!
Witaj na talk.maemo.org!

Useful links for newcomers:
Użyteczne linki:
Nowi użyktownicy mówią cześć | New members say hello , Tu zaczynają nowi użytkownicy | New users start here, Podforum społeczności | Community subforum, Wiki dla początkujących | Beginners' wiki page, Maemo5 101, Często zadawane pytania | Frequently Asked Questions (FAQ), Google

Jeżeli mogę w czymś pomóc, pytaj!
If I can help with anything else, just ask!

Bored? Follow me
 
Reply


 
Forum Jump


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