github.com/bluenviron/gomavlib/v2@v2.2.1-0.20240308101627-2c07e3da629c/pkg/dialects/ardupilotmega/enum_gopro_protune_white_balance.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_WHITE_BALANCE uint64
    11  
    12  const (
    13  	// Auto.
    14  	GOPRO_PROTUNE_WHITE_BALANCE_AUTO GOPRO_PROTUNE_WHITE_BALANCE = 0
    15  	// 3000K.
    16  	GOPRO_PROTUNE_WHITE_BALANCE_3000K GOPRO_PROTUNE_WHITE_BALANCE = 1
    17  	// 5500K.
    18  	GOPRO_PROTUNE_WHITE_BALANCE_5500K GOPRO_PROTUNE_WHITE_BALANCE = 2
    19  	// 6500K.
    20  	GOPRO_PROTUNE_WHITE_BALANCE_6500K GOPRO_PROTUNE_WHITE_BALANCE = 3
    21  	// Camera Raw.
    22  	GOPRO_PROTUNE_WHITE_BALANCE_RAW GOPRO_PROTUNE_WHITE_BALANCE = 4
    23  )
    24  
    25  var labels_GOPRO_PROTUNE_WHITE_BALANCE = map[GOPRO_PROTUNE_WHITE_BALANCE]string{
    26  	GOPRO_PROTUNE_WHITE_BALANCE_AUTO:  "GOPRO_PROTUNE_WHITE_BALANCE_AUTO",
    27  	GOPRO_PROTUNE_WHITE_BALANCE_3000K: "GOPRO_PROTUNE_WHITE_BALANCE_3000K",
    28  	GOPRO_PROTUNE_WHITE_BALANCE_5500K: "GOPRO_PROTUNE_WHITE_BALANCE_5500K",
    29  	GOPRO_PROTUNE_WHITE_BALANCE_6500K: "GOPRO_PROTUNE_WHITE_BALANCE_6500K",
    30  	GOPRO_PROTUNE_WHITE_BALANCE_RAW:   "GOPRO_PROTUNE_WHITE_BALANCE_RAW",
    31  }
    32  
    33  var values_GOPRO_PROTUNE_WHITE_BALANCE = map[string]GOPRO_PROTUNE_WHITE_BALANCE{
    34  	"GOPRO_PROTUNE_WHITE_BALANCE_AUTO":  GOPRO_PROTUNE_WHITE_BALANCE_AUTO,
    35  	"GOPRO_PROTUNE_WHITE_BALANCE_3000K": GOPRO_PROTUNE_WHITE_BALANCE_3000K,
    36  	"GOPRO_PROTUNE_WHITE_BALANCE_5500K": GOPRO_PROTUNE_WHITE_BALANCE_5500K,
    37  	"GOPRO_PROTUNE_WHITE_BALANCE_6500K": GOPRO_PROTUNE_WHITE_BALANCE_6500K,
    38  	"GOPRO_PROTUNE_WHITE_BALANCE_RAW":   GOPRO_PROTUNE_WHITE_BALANCE_RAW,
    39  }
    40  
    41  // MarshalText implements the encoding.TextMarshaler interface.
    42  func (e GOPRO_PROTUNE_WHITE_BALANCE) MarshalText() ([]byte, error) {
    43  	if name, ok := labels_GOPRO_PROTUNE_WHITE_BALANCE[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_WHITE_BALANCE) UnmarshalText(text []byte) error {
    51  	if value, ok := values_GOPRO_PROTUNE_WHITE_BALANCE[string(text)]; ok {
    52  		*e = value
    53  	} else if value, err := strconv.Atoi(string(text)); err == nil {
    54  		*e = GOPRO_PROTUNE_WHITE_BALANCE(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_WHITE_BALANCE) String() string {
    63  	val, _ := e.MarshalText()
    64  	return string(val)
    65  }