User Tools

Site Tools


geofencedsl
no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


Previous revision
Next revision
geofencedsl [2011/01/25 22:33] donpdonp
Line 1: Line 1:
 +== GeoFence DSL ==
 +
 +Allow users to write javascript to do what they want to with geofence events.
 +Attach a code blob to a fence, to automatically be run on any event for that fence.
 +Attach a blob to the user account to run on any fence event.
 +
 +
 +Variables
 +<code>
 +event = { "fence" : <The specific fence that caused the event>
 +           "date" : <trigger date>
 +           "verb" : "IN" | "OUT"
 +         }
 +fences[] - access to each of the user defined geofences
 +fence = { 
 +     "name" : "Bob's GeoFence",
 +     "geometry": {
 +        "type": "Polygon",
 +        "coordinates": [
 +          [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0],
 +            [100.0, 1.0], [100.0, 0.0] ]
 +          ]
 +      } /* from http://locationcommons.org/index.php?title=GeoFence */
 +inside_fences[] - list of fences currently "inside"
 +</code>
 +  
 +Send an email on every fence crossing (blob attached to the user)
 +<code>
 + if event.verb == "IN" {
 +    email("don@don", "Fence entered!")
 + }
 +</code>
 +
 +A fence attached blob will provide the fence variable
 +<code>
 + if (event.verb == "IN") {
 +    if ((new Date()) - fence.inside_trigger_time > 10.minutes) {
 +      email("brennan", "Nerdout at the ACE Hotel!")
 +    }
 + }
 +</code>
  
geofencedsl.txt · Last modified: 2024/01/31 04:08 by 127.0.0.1