maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   [ANNOUNCE] locationd - generate location-based alerts (https://talk.maemo.org/showthread.php?t=64681)

kushal.kumaran 2010-10-29 16:36

[ANNOUNCE] locationd - generate location-based alerts
 
Hi,

I've been working on an application that can generate alerts based on your current location. In its current state, it will generate dbus signals when a user-defined point of interest is nearby.

I'm now learning how to create a desktop widget that can watch the dbus notifications and do something useful with them, but even as it is, it can still find interesting use, perhaps with dbus-scripts.

The code is in python, and requires the python-location library installed.

Grab the .deb from https://bitbucket.org/kushal_kumaran...iond/downloads, or clone the repository to take a look at the source.

Some notes on usage are in the wiki at https://bitbucket.org/kushal_kumaran...iond/wiki/Home

Reffyyyy 2010-10-29 16:42

Re: [ANNOUNCE] locationd - generate location-based alerts
 
I thought Queen Beecon Widget has the capability of executing a script upon a Dbus event.

kushal.kumaran 2010-10-31 06:09

Re: [ANNOUNCE] locationd - generate location-based alerts
 
Thanks for the pointer. I will take a look at Queen BeeCon.

webhamster 2010-11-07 21:03

Re: [ANNOUNCE] locationd - generate location-based alerts
 
Quote:

Originally Posted by Reffyyyy (Post 856820)
I thought Queen Beecon Widget has the capability of executing a script upon a Dbus event.

I'd be glad to have such a feature independent of Queen Beecon Widget, as that looks rather... oldfashioned. Or are there other themes than the ones from the screenshots?

ny-hardcore 2010-11-08 16:07

Re: [ANNOUNCE] locationd - generate location-based alerts
 
Quote:

Originally Posted by kushal.kumaran (Post 856813)
Hi,

I've been working on an application that can generate alerts based on your current location. In its current state, it will generate dbus signals when a user-defined point of interest is nearby.

I'm now learning how to create a desktop widget that can watch the dbus notifications and do something useful with them, but even as it is, it can still find interesting use, perhaps with dbus-scripts.

The code is in python, and requires the python-location library installed.

Grab the .deb from https://bitbucket.org/kushal_kumaran...iond/downloads, or clone the repository to take a look at the source.

Some notes on usage are in the wiki at https://bitbucket.org/kushal_kumaran...iond/wiki/Home

Thank you for making this!

I tried this yesterday and it seems to work ...

I see in the dbus-monitor that dbus events are being sent when i query current_location and nearby_location
I suspect that dbus signals are sent when a location is nearby?
is there a treshold that defines "nearby"?

Is it possible to provide a sample dbus-scripts
rule for the nearby signal?
I want to try if i can start/stop fmtx and mediaplayer based on location

furthermore, do you have plans on making a GUI for editing the places.csv?
If not I am willing to give it a go
(i have no python experience. but seems like a nice starting project)

kushal.kumaran 2010-11-13 07:32

Re: [ANNOUNCE] locationd - generate location-based alerts
 
Thank you for taking the time to try locationd out. First, answers to your queries:

Quote:

Originally Posted by ny-hardcore (Post 867074)
Thank you for making this!

I tried this yesterday and it seems to work ...

I see in the dbus-monitor that dbus events are being sent when i query current_location and nearby_location
I suspect that dbus signals are sent when a location is nearby?
is there a treshold that defines "nearby"?

Yes, there are two (arbitrarily-chosen) thresholds involved. First, locationd ignores GPS updates with the horizontal accuracy (eph) greater than 100 metres. Second, the threshold that defines "nearby" is 50 metres. This threshold will be configurable in a future version.

Quote:

Originally Posted by ny-hardcore (Post 867074)
Is it possible to provide a sample dbus-scripts
rule for the nearby signal?
I want to try if i can start/stop fmtx and mediaplayer based on location

Sure. The first thing you need to do is to run dbus-scripts on the session bus, because that's where locationd is generating its signals. The dbusscripts wiki page has instructions on how to do this. Then add a file in the /etc/dbus-scripts.d directory with the following contents (this is what I did, feel free to customize as needed):

Code:

/home/user/bin/log-location * * net.locationd poi_nearby
/home/user/bin/log-location * * net.locationd poi_distant

Then create the script /home/user/bin/log-location to do what you need it to. I simply dumped the arguments to a file, and ended up with a file looking like this:

Code:

:1.797 null net.locationd poi_nearby home
You can write the script in whatever language you are comfortable with. And you can perform any action depending on the arguments you get.

Quote:

Originally Posted by ny-hardcore (Post 867074)
furthermore, do you have plans on making a GUI for editing the places.csv?
If not I am willing to give it a go
(i have no python experience. but seems like a nice starting project)

Please try out the latest revision of locationd from https://bitbucket.org/kushal_kumaran...iond/downloads. This adds a script, and a dbus method to add the current location to places.csv. Simple usage instructions are on the wiki at https://bitbucket.org/kushal_kumaran...iond/wiki/Home.

I haven't myself started any work on a GUI (I plead the real-life-intervened excuse) but I do have plans there. Feel free to work on it if you like, because I don't yet know how long it will take me to finish it. I'm in way over my head here with technologies I'm not fully familiar with yet (dbus, gtk, maemo widgets, debian packaging).

kushal.kumaran 2011-01-30 07:40

Re: [ANNOUNCE] locationd - generate location-based alerts
 
An update: locationd 0.3 is now available.

Get the .deb from https://bitbucket.org/kushal_kumaran..._0.3-1_all.deb

What's New:
- a simple GUI, which allows starting and stopping monitoring and show list of nearby places

The wiki at https://bitbucket.org/kushal_kumaran...iond/wiki/Home has a screenshot of the new GUI, which requires pyside.

geekgirl74 2011-01-30 20:50

Re: [ANNOUNCE] locationd - generate location-based alerts
 
Quote:

Originally Posted by kushal.kumaran (Post 931714)
An update: locationd 0.3 is now available.

Get the .deb from https://bitbucket.org/kushal_kumaran..._0.3-1_all.deb

What's New:
- a simple GUI, which allows starting and stopping monitoring and show list of nearby places

The wiki at https://bitbucket.org/kushal_kumaran...iond/wiki/Home has a screenshot of the new GUI, which requires pyside.

The wiki isn't accessable. I only get a bitbucket login window.

kushal.kumaran 2011-01-31 04:04

Re: [ANNOUNCE] locationd - generate location-based alerts
 
Quote:

Originally Posted by geekgirl74 (Post 932108)
The wiki isn't accessable. I only get a bitbucket login window.

My mistake. I've made the wiki publicly accessible now.

bobbydoedoe 2011-02-01 01:44

Re: [ANNOUNCE] locationd - generate location-based alerts
 
op: anyway to make the location sensing based on gsm network instead of gps?? ie: like if the phone detects its within a define gsm tower, it will an alert or even better, run a script/command.

5spdvl 2011-02-01 02:27

Re: [ANNOUNCE] locationd - generate location-based alerts
 
That would be cool bobbydoedoe.

Otherwise this is a good app. Any chance to move it into repos?

bobbydoedoe 2011-02-01 03:08

Re: [ANNOUNCE] locationd - generate location-based alerts
 
Quote:

Originally Posted by 5spdvl (Post 933048)
That would be cool bobbydoedoe.

Otherwise this is a good app. Any chance to move it into repos?

i know, if only i have the programming ability :(

caco3 2011-05-21 09:50

Re: [ANNOUNCE] locationd - generate location-based alerts
 
This is a very great application. I was just looking into how to build an application like this myself when I stumbled over this.

I would like to help to develop this application further!
I.e. add it to the maemo repo and add some features.

Some parts I miss:
  • Select points on a (open street) map and store them in the database
  • set a radios for each POI (alarm occurs when you get inside this circle)
  • see distance to POIs

I also found some bugs:
I started "locationd" in the terminal, it seems to run fine. Then I tried to add a POI: "locationd-add Home". This gave the following error:
Code:

Error org.freedesktop.DBus.Python.OSError: Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.5/dbus/service.py", line 702, in _message_cb
    retval = candidate_method(self, *args, **keywords)
  File "/usr/lib/pymodules/python2.5/molly/daemon.py", line 121, in add_poi
    places_manager.add_current_location(place_name)
  File "/usr/lib/pymodules/python2.5/molly/db.py", line 128, in add_current_location
    self._save_places()
  File "/usr/lib/pymodules/python2.5/molly/db.py", line 72, in _save_places
    os.rename(tempfile_name, self.config_obj.get_places_filename())
OSError: [Errno 2] No such file or directory

How ever the POI showed up in the already running locationd-qt GUI!
Nevertheless, the places file in "/etc/locationd/places.csv" still does not exist. As I do not have an example I am not sure how I would have to create its content. As the GPS locations can be noted differently, there should be an example. Also I would suggest that the file gets generated at the installation time, together with an example POI.Despite of all of that, this places file should be in a user writeable location! I would suggest "/home/user/.locationd/places.csv".

kushal.kumaran 2011-05-22 10:26

Re: [ANNOUNCE] locationd - generate location-based alerts
 
Quote:

Originally Posted by caco3 (Post 1011804)
This is a very great application. I was just looking into how to build an application like this myself when I stumbled over this.

I would like to help to develop this application further!
I.e. add it to the maemo repo and add some features.

Some parts I miss:
  • Select points on a (open street) map and store them in the database
  • set a radios for each POI (alarm occurs when you get inside this circle)
  • see distance to POIs

All excellent suggestions, thanks. I would appreciate any help making the GUI better, since my own knowledge of doing any GUI development is rather limited. You can take a look at the existing code. It uses pyside, but I'm not fanatical about this. I'm sure you could do a better job with PyQt, if you're more familiar with that.

The source is hosted on bitbucket, at https://bitbucket.org/kushal_kumaran/locationd, which you can fork and modify. Patches welcome :)

Quote:

Originally Posted by caco3 (Post 1011804)
I also found some bugs:
I started "locationd" in the terminal, it seems to run fine. Then I tried to add a POI: "locationd-add Home". This gave the following error:
Code:

Error org.freedesktop.DBus.Python.OSError: Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.5/dbus/service.py", line 702, in _message_cb
    retval = candidate_method(self, *args, **keywords)
  File "/usr/lib/pymodules/python2.5/molly/daemon.py", line 121, in add_poi
    places_manager.add_current_location(place_name)
  File "/usr/lib/pymodules/python2.5/molly/db.py", line 128, in add_current_location
    self._save_places()
  File "/usr/lib/pymodules/python2.5/molly/db.py", line 72, in _save_places
    os.rename(tempfile_name, self.config_obj.get_places_filename())
OSError: [Errno 2] No such file or directory

How ever the POI showed up in the already running locationd-qt GUI!
Nevertheless, the places file in "/etc/locationd/places.csv" still does not exist. As I do not have an example I am not sure how I would have to create its content. As the GPS locations can be noted differently, there should be an example. Also I would suggest that the file gets generated at the installation time, together with an example POI.Despite of all of that, this places file should be in a user writeable location! I would suggest "/home/user/.locationd/places.csv".

The code has a bug where it doesn't create the /etc/locationd directory before it tries to copy a file into it. You can create the directory and it will work.

I've started work on locationd again after a long break and I plan to go through these issues as soon as I can.

Also thanks to everyone for showing interest in this project.

caco3 2011-05-22 11:04

Re: [ANNOUNCE] locationd - generate location-based alerts
 
2 Attachment(s)
Its great to see your quick reply :)

I couldn't wait for your answer and started to dig myself into the GPS handling. When I realised that it is very easy and well documented (http://wiki.maemo.org/PyMaemo/Using_Location_API), I quickly wrote my own application.
It does not yet have much interactions but shows how it works. I will especially continue working on the GUI.
How ever it doesn't make much sense to have 2 similar applications, so I would like to merge it with your application!
2 developers can reach more than one :)

As you can see on the screenshot, I also want to show the distance, so we would have to add that in your code, if possible.
Also I did not understand why you use the molly framework. What is the advantage of it?

If you want to test my app, extract the attachment to a folder on your N900 and start it with "python main.py".

caco3 2011-05-23 20:44

Re: [ANNOUNCE] locationd - generate location-based alerts
 
3 Attachment(s)
Hi all

Please have a look on this next beta version.
Its already a functional version.
The GUI how ever still can be improved.
I even plan to integrate a map screen, from where you can select a location.

Please give some feedback/improvements


All times are GMT. The time now is 11:37.

vBulletin® Version 3.8.8