2019-12-21 17:13:58 +00:00
|
|
|
package types
|
2019-11-30 20:49:19 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"log"
|
|
|
|
)
|
|
|
|
|
|
|
|
type DriveMode int
|
|
|
|
|
|
|
|
const (
|
|
|
|
DriveModeInvalid = -1
|
|
|
|
DriveModeUser = iota
|
|
|
|
DriveModePilot
|
|
|
|
)
|
|
|
|
|
|
|
|
func ToString(mode DriveMode) string {
|
|
|
|
switch mode {
|
|
|
|
case DriveModeUser:
|
|
|
|
return "user"
|
|
|
|
case DriveModePilot:
|
|
|
|
return "pilot"
|
|
|
|
default:
|
|
|
|
return ""
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func ParseString(val string) DriveMode {
|
|
|
|
switch val {
|
|
|
|
case "user":
|
|
|
|
return DriveModeUser
|
|
|
|
case "pilot":
|
|
|
|
return DriveModePilot
|
|
|
|
default:
|
|
|
|
log.Printf("invalid DriveMode: %v", val)
|
|
|
|
return DriveModeInvalid
|
|
|
|
}
|
|
|
|
}
|