User Tools

Site Tools


geofencedsl

Differences

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

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
geofencedsl [2011/01/25 22:01] – created donpdonpgeofencedsl [2011/01/25 22:26] donpdonp
Line 1: Line 1:
 == GeoFence DSL == == GeoFence DSL ==
  
-javascript +Allow users to write javascript to do what they want to with geofence events.
  
-fences[] - access to each of the defined geofences 
  
 +Variables
 <code> <code>
- +event = "fence" : <The specific fence that caused the event> 
-function init() +           "date" : <trigger date> 
-+           "verb" : "IN" | "OUT" 
- +         
-function event(detail) +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> </code>
      
 +Send an email on every fence crossing
 +<code>
 + if event.verb == "IN" {
 +    email("don@don", "Fence entered!")
 + }
 +</code>
 +
 +Email Brennan after being at the Ace for more than 10 minutes
 +<code>
 + ace = fences["Ace Hotel"]
 + if (event.verb == "IN" && event.fence == ace) {
 +    if ((new Date()) - ace.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