package main
|
|
|
|
import (
|
|
"github.com/gofiber/fiber/v2"
|
|
)
|
|
|
|
type TestCommand struct {
|
|
Command string `json:"cmd"`
|
|
SequenceId int `json:"sequenceId"`
|
|
}
|
|
|
|
var currentTest *TestCommand
|
|
|
|
func setTestCmd(c *fiber.Ctx) error {
|
|
var testCmd TestCommand
|
|
if err := c.BodyParser(&testCmd); nil != err {
|
|
return failureResponse(c, "-1", err.Error(), 400)
|
|
} else if nil == currentScene {
|
|
return failureResponse(c, "1", "not in a working scene", 400)
|
|
} else {
|
|
currentTest = &testCmd
|
|
return successResponse(c, "Updated successfully.")
|
|
}
|
|
}
|
|
|
|
func init() {
|
|
currentTest = nil
|
|
}
|