Drop unnecessary api parameters

This commit is contained in:
Adrian Zankich 2013-11-27 20:35:32 -08:00
parent d0176c313e
commit 77dd6dbae3
2 changed files with 5 additions and 4 deletions

4
api.go
View File

@ -31,6 +31,10 @@ func Api(bot *Master) {
decoder := json.NewDecoder(req.Body)
var body map[string]interface{}
decoder.Decode(&body)
if len(body) == 0 {
body = map[string]interface{}{}
}
body["robotname"] = params["robotname"]
return a.executeRobotCommand(bot, params, body)
})

View File

@ -1,7 +1,6 @@
package main
import (
"fmt"
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot-sphero"
)
@ -9,9 +8,7 @@ import (
var Master *gobot.Master = gobot.GobotMaster()
func TurnBlue(params map[string]interface{}) bool {
name := params["name"].(string)
device := params["device"].(string)
sphero := Master.FindRobotDevice(name, device)
sphero := Master.FindRobotDevice(params["robotname"].(string), "sphero")
gobot.Call(sphero.Driver, "SetRGB", uint8(0), uint8(0), uint8(255))
return true
}