Making pebble finally work on gobot
This commit is contained in:
parent
2d8ba7206d
commit
71c6a66049
|
@ -10,7 +10,9 @@ import (
|
|||
|
||||
func main() {
|
||||
gbot := gobot.NewGobot()
|
||||
api.NewAPI(gbot).Start()
|
||||
api := api.NewAPI(gbot)
|
||||
api.Port = "8080"
|
||||
api.Start()
|
||||
|
||||
pebbleAdaptor := pebble.NewPebbleAdaptor("pebble")
|
||||
pebbleDriver := pebble.NewPebbleDriver(pebbleAdaptor, "pebble")
|
||||
|
|
|
@ -26,7 +26,7 @@ func NewPebbleDriver(adaptor *PebbleAdaptor, name string) *PebbleDriver {
|
|||
p.AddEvent("accel")
|
||||
p.AddEvent("tap")
|
||||
|
||||
p.AddCommand("PublishEvent", func(params map[string]interface{}) interface{} {
|
||||
p.AddCommand("publish_event", func(params map[string]interface{}) interface{} {
|
||||
p.PublishEvent(params["name"].(string), params["data"].(string))
|
||||
return nil
|
||||
})
|
||||
|
@ -36,10 +36,8 @@ func NewPebbleDriver(adaptor *PebbleAdaptor, name string) *PebbleDriver {
|
|||
return nil
|
||||
})
|
||||
|
||||
p.AddCommand("PendingMessage", func(params map[string]interface{}) interface{} {
|
||||
m := make(map[string]string)
|
||||
m["result"] = p.PendingMessage()
|
||||
return m
|
||||
p.AddCommand("pending_message", func(params map[string]interface{}) interface{} {
|
||||
return p.PendingMessage()
|
||||
})
|
||||
|
||||
return p
|
||||
|
|
Loading…
Reference in New Issue