Thread: LocCommand
View Single Post
joerg_rw's Avatar
Posts: 2,222 | Thanked: 12,651 times | Joined on Mar 2010 @ SOL 3
#3
you might want to have a look at dwimd: http://maemo.org/packages/view/dwimd/

http://hg.alexanderweb.de/dwimd-main...aa9/README.txt
dwimd
=====
the ambient sensing gestalt optimizer for the n900

dwimd works by sampling sensors and taking user-defined actions
based on a user-written config file.

Howto
=====
1. Look at http://hg.alexanderweb.de/dwimd-main...alex_config.py
how a config file should look like.
2. Write your own config file. Every function is executed every 30 seconds.
You can use the values and actions explained below.
3. Copy your config file to /etc/dwimd/dwimd_plugins/configs. It should have
a .py extension.

Reference
=========
dwimd ships the following sensors:
* history: Not really a sensor, it buffers data and returns the buffered
data as a list.
* load: Provides the system load as `load`.
* locationcheck: Provides the current location as `location`. Such location
objects then have a `near` method that should be called with
the name of a location that was previously defined with
`define_location`. `define_location` takes a name and either
`network_in_sight="network_name"` for wifi sensing or
`coordinates=(50, 8, 100)` for an 100m circle around
the GPS coordinates 50N 8E.
* moving: Provides `moving` and `not_moving_for_5min`. The latter is useful
for autoaway.
* orientation: Provides `orientation`, `face_up` and `on_stand`. `orientation`
either contains "portrait" or "landscape" or the same string
with " (inverse)" appended (XXX check). The other two variables
are booleans.
* time: Provides `time` which supports `time.between("12:00", "15:00")` like
calls.

It ships the following actions. These are activatable by using the verbs explained below.
* availability: Should be activated with a status like "online" or "away". Additionally,
`availability_message` can be activated with the status message.
* lock: If activated with `off`, avoids that the screen locks.
* profile: Can be activated with a profile name that should be switched to (like
"silent" or "general").
* wifi: Should be activated with a network name as the value.

These verbs are provided to activate an action:
* require(object, value) triggers an error if somebody votes against it
* suggest(object, value) is a weak vote (defaults values but does not count in votes)
* vote(object, value, votes) is used for voting
* force(object, value) overwrites requires and votes
where object is a gestalt name or an action.

Gestalts can be defined like this:
define_gestalt("Default",
availability="available",
profile="general")
They group similar action values.

TODO
====

* Adjustable sample rate for every plugin.
* Planned inputs:
gps, time, weekday, load, location, orientation
charging, playing, display, locked, noise level, ringing
* planned outputs:
availability, profile, cellular, secure, lock, wifi
os.system

The project seems in a limbo state, nevertheless it might have parts and ideas and concepts that are worth pondering.

Keep on hacking, something like a location aware event trigger daemon is quite a useful and missing bit.

cheers
jOERG
__________________
Maemo Community Council member [2012-10, 2013-05, 2013-11, 2014-06 terms]
Hildon Foundation Council inaugural member.
MCe.V. foundation member

EX Hildon Foundation approved
Maemo Administration Coordinator (stepped down due to bullying 2014-04-05)
aka "techstaff" - the guys who keep your infra running - Devotion to Duty http://xkcd.com/705/

IRC(freenode): DocScrutinizer*
First USB hostmode fanatic, father of H-E-N

Last edited by joerg_rw; 2011-01-30 at 17:03.
 

The Following User Says Thank You to joerg_rw For This Useful Post: