mirror of
https://github.com/supanadit/geo-smart-system.git
synced 2024-11-24 17:46:21 +00:00
Trigger Type
This commit is contained in:
parent
98ca740a7e
commit
8a8364da2c
4
main.go
4
main.go
@ -12,6 +12,7 @@ import (
|
||||
"github.com/supanadit/geo-smart-system/model/tile38"
|
||||
"log"
|
||||
"net/http"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
@ -86,7 +87,8 @@ func main() {
|
||||
hookID := "HOOK-" + xid.New().String()
|
||||
fmt.Printf("Set HOOK with ID : %s \n", hookID)
|
||||
hookURL := "http://192.168.99.1:" + port + "/detection/call"
|
||||
client.Do("SETHOOK", hookID, hookURL, "NEARBY", detection.Type, "FENCE", "DETECT", "enter", "COMMANDS", "set", "POINT", detection.Lat, detection.Lng)
|
||||
trigger := strings.Join(detection.TriggerType, ",")
|
||||
client.Do("SETHOOK", hookID, hookURL, "NEARBY", detection.Type, "FENCE", "DETECT", trigger, "COMMANDS", "set", "POINT", detection.Lat, detection.Lng)
|
||||
var status map[string]interface{}
|
||||
var httpStatus int
|
||||
if err != nil {
|
||||
|
@ -1,18 +1,17 @@
|
||||
package model
|
||||
|
||||
type Trigger string
|
||||
|
||||
// Trigger Type
|
||||
const (
|
||||
inside Trigger = "inside" // when an object is inside the specified area
|
||||
outside Trigger = "outside" // when an object is outside the specified area
|
||||
enter Trigger = "enter" // when an object that was not previously in the fence has entered the area
|
||||
exit Trigger = "exit" // when an object that was previously in the fence has exited the area
|
||||
cross Trigger = "cross" // when an object that was not previously in the fence has entered and exited the area
|
||||
inside string = "inside" // when an object is inside the specified area
|
||||
outside string = "outside" // when an object is outside the specified area
|
||||
enter string = "enter" // when an object that was not previously in the fence has entered the area
|
||||
exit string = "exit" // when an object that was previously in the fence has exited the area
|
||||
cross string = "cross" // when an object that was not previously in the fence has entered and exited the area
|
||||
)
|
||||
|
||||
type Detection struct {
|
||||
Type string `json:"type"`
|
||||
Lat string `json:"lat"`
|
||||
Lng string `json:"lng"`
|
||||
TriggerType []Trigger `json:"trigger_type"`
|
||||
Type string `json:"type"`
|
||||
Lat string `json:"lat"`
|
||||
Lng string `json:"lng"`
|
||||
TriggerType []string `json:"trigger"`
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user