github.com/bluenviron/gomavlib/v2@v2.2.1-0.20240308101627-2c07e3da629c/pkg/dialects/ardupilotmega/enum_gopro_protune_gain.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 type GOPRO_PROTUNE_GAIN uint64 11 12 const ( 13 // ISO 400. 14 GOPRO_PROTUNE_GAIN_400 GOPRO_PROTUNE_GAIN = 0 15 // ISO 800 (Only Hero 4). 16 GOPRO_PROTUNE_GAIN_800 GOPRO_PROTUNE_GAIN = 1 17 // ISO 1600. 18 GOPRO_PROTUNE_GAIN_1600 GOPRO_PROTUNE_GAIN = 2 19 // ISO 3200 (Only Hero 4). 20 GOPRO_PROTUNE_GAIN_3200 GOPRO_PROTUNE_GAIN = 3 21 // ISO 6400. 22 GOPRO_PROTUNE_GAIN_6400 GOPRO_PROTUNE_GAIN = 4 23 ) 24 25 var labels_GOPRO_PROTUNE_GAIN = map[GOPRO_PROTUNE_GAIN]string{ 26 GOPRO_PROTUNE_GAIN_400: "GOPRO_PROTUNE_GAIN_400", 27 GOPRO_PROTUNE_GAIN_800: "GOPRO_PROTUNE_GAIN_800", 28 GOPRO_PROTUNE_GAIN_1600: "GOPRO_PROTUNE_GAIN_1600", 29 GOPRO_PROTUNE_GAIN_3200: "GOPRO_PROTUNE_GAIN_3200", 30 GOPRO_PROTUNE_GAIN_6400: "GOPRO_PROTUNE_GAIN_6400", 31 } 32 33 var values_GOPRO_PROTUNE_GAIN = map[string]GOPRO_PROTUNE_GAIN{ 34 "GOPRO_PROTUNE_GAIN_400": GOPRO_PROTUNE_GAIN_400, 35 "GOPRO_PROTUNE_GAIN_800": GOPRO_PROTUNE_GAIN_800, 36 "GOPRO_PROTUNE_GAIN_1600": GOPRO_PROTUNE_GAIN_1600, 37 "GOPRO_PROTUNE_GAIN_3200": GOPRO_PROTUNE_GAIN_3200, 38 "GOPRO_PROTUNE_GAIN_6400": GOPRO_PROTUNE_GAIN_6400, 39 } 40 41 // MarshalText implements the encoding.TextMarshaler interface. 42 func (e GOPRO_PROTUNE_GAIN) MarshalText() ([]byte, error) { 43 if name, ok := labels_GOPRO_PROTUNE_GAIN[e]; ok { 44 return []byte(name), nil 45 } 46 return []byte(strconv.Itoa(int(e))), nil 47 } 48 49 // UnmarshalText implements the encoding.TextUnmarshaler interface. 50 func (e *GOPRO_PROTUNE_GAIN) UnmarshalText(text []byte) error { 51 if value, ok := values_GOPRO_PROTUNE_GAIN[string(text)]; ok { 52 *e = value 53 } else if value, err := strconv.Atoi(string(text)); err == nil { 54 *e = GOPRO_PROTUNE_GAIN(value) 55 } else { 56 return fmt.Errorf("invalid label '%s'", text) 57 } 58 return nil 59 } 60 61 // String implements the fmt.Stringer interface. 62 func (e GOPRO_PROTUNE_GAIN) String() string { 63 val, _ := e.MarshalText() 64 return string(val) 65 }