github.com/bluenviron/gomavlib/v2@v2.2.1-0.20240308101627-2c07e3da629c/pkg/dialects/ardupilotmega/enum_osd_param_config_error.go (about) 1 //autogenerated:yes 2 //nolint:revive,misspell,govet,lll,dupl,gocritic 3 package ardupilotmega 4 5 import ( 6 "fmt" 7 "strconv" 8 ) 9 10 // The error type for the OSD parameter editor. 11 type OSD_PARAM_CONFIG_ERROR uint64 12 13 const ( 14 OSD_PARAM_SUCCESS OSD_PARAM_CONFIG_ERROR = 0 15 OSD_PARAM_INVALID_SCREEN OSD_PARAM_CONFIG_ERROR = 1 16 OSD_PARAM_INVALID_PARAMETER_INDEX OSD_PARAM_CONFIG_ERROR = 2 17 OSD_PARAM_INVALID_PARAMETER OSD_PARAM_CONFIG_ERROR = 3 18 ) 19 20 var labels_OSD_PARAM_CONFIG_ERROR = map[OSD_PARAM_CONFIG_ERROR]string{ 21 OSD_PARAM_SUCCESS: "OSD_PARAM_SUCCESS", 22 OSD_PARAM_INVALID_SCREEN: "OSD_PARAM_INVALID_SCREEN", 23 OSD_PARAM_INVALID_PARAMETER_INDEX: "OSD_PARAM_INVALID_PARAMETER_INDEX", 24 OSD_PARAM_INVALID_PARAMETER: "OSD_PARAM_INVALID_PARAMETER", 25 } 26 27 var values_OSD_PARAM_CONFIG_ERROR = map[string]OSD_PARAM_CONFIG_ERROR{ 28 "OSD_PARAM_SUCCESS": OSD_PARAM_SUCCESS, 29 "OSD_PARAM_INVALID_SCREEN": OSD_PARAM_INVALID_SCREEN, 30 "OSD_PARAM_INVALID_PARAMETER_INDEX": OSD_PARAM_INVALID_PARAMETER_INDEX, 31 "OSD_PARAM_INVALID_PARAMETER": OSD_PARAM_INVALID_PARAMETER, 32 } 33 34 // MarshalText implements the encoding.TextMarshaler interface. 35 func (e OSD_PARAM_CONFIG_ERROR) MarshalText() ([]byte, error) { 36 if name, ok := labels_OSD_PARAM_CONFIG_ERROR[e]; ok { 37 return []byte(name), nil 38 } 39 return []byte(strconv.Itoa(int(e))), nil 40 } 41 42 // UnmarshalText implements the encoding.TextUnmarshaler interface. 43 func (e *OSD_PARAM_CONFIG_ERROR) UnmarshalText(text []byte) error { 44 if value, ok := values_OSD_PARAM_CONFIG_ERROR[string(text)]; ok { 45 *e = value 46 } else if value, err := strconv.Atoi(string(text)); err == nil { 47 *e = OSD_PARAM_CONFIG_ERROR(value) 48 } else { 49 return fmt.Errorf("invalid label '%s'", text) 50 } 51 return nil 52 } 53 54 // String implements the fmt.Stringer interface. 55 func (e OSD_PARAM_CONFIG_ERROR) String() string { 56 val, _ := e.MarshalText() 57 return string(val) 58 }