User Tools

Site Tools


geofencedsl

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
geofencedsl [2011/01/25 14:12]
donpdonp
geofencedsl [2016/06/25 11:25] (current)
Line 1: Line 1:
 == GeoFence DSL == == GeoFence DSL ==
  
-javascript language.+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 Variables
 <code> <code>
-detail = { fence : <The specific fence that caused the event> +event = { "fence: <The specific fence that caused the event> 
-           date : <trigger date> +           "date: <trigger date> 
-           verb : IN | OUT+           "verb"IN"OUT"
          }          }
 fences[] - access to each of the user defined geofences 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" inside_fences[] - list of fences currently "inside"
 </code> </code>
      
 +Send an email on every fence crossing (blob attached to the user)
 <code> <code>
- if detail.verb == "IN" {+ if event.verb == "IN" {
     email("don@don", "Fence entered!")     email("don@don", "Fence entered!")
  }  }
 </code> </code>
  
 +Send an email if I'm at the ACE for 10 minutes (blob attached to the fence)
 <code> <code>
- ace = fences["Ace Hotel"+ if (event.verb == "IN") { 
- if (detail.verb == "IN" && detail.fence == ace) { +    if ((new Date()) fence.inside_trigger_time 10.minutes) {
-    if (ace.inside_trigger_date Time.now 15.minutes) {+
       email("brennan", "Nerdout at the ACE Hotel!")       email("brennan", "Nerdout at the ACE Hotel!")
     }     }
  }  }
 </code> </code>
 +
geofencedsl.1295993535.txt.gz · Last modified: 2016/06/25 11:25 (external edit)