Skip to content

Commit

Permalink
Merge pull request hybridgroup#86 from hybridgroup/pebble-api
Browse files Browse the repository at this point in the history
Making pebble finally work on gobot
  • Loading branch information
zankich committed Aug 1, 2014
2 parents 2d8ba72 + a155efa commit c817295
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion examples/pebble.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
4 changes: 3 additions & 1 deletion examples/pebble_accelerometer.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import (

func main() {
gbot := gobot.NewGobot()
api.NewAPI(gbot).Start()
a := api.NewAPI(gbot)
a.Port = "8080"
a.Start()

pebbleAdaptor := pebble.NewPebbleAdaptor("pebble")
pebbleDriver := pebble.NewPebbleDriver(pebbleAdaptor, "pebble")
Expand Down
8 changes: 3 additions & 5 deletions platforms/pebble/pebble_driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand All @@ -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
Expand Down

0 comments on commit c817295

Please sign in to comment.