Making pebble finally work on gobot

This commit is contained in:
Javier Cervantes 2014-07-31 13:56:50 -05:00
parent 2d8ba7206d
commit 71c6a66049
2 changed files with 6 additions and 6 deletions

View File

@ -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")

View File

@ -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