github.com/bluenviron/gomavlib/v2@v2.2.1-0.20240308101627-2c07e3da629c/pkg/dialects/ardupilotmega/enum_gopro_heartbeat_status.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_HEARTBEAT_STATUS uint64
    11  
    12  const (
    13  	// No GoPro connected.
    14  	GOPRO_HEARTBEAT_STATUS_DISCONNECTED GOPRO_HEARTBEAT_STATUS = 0
    15  	// The detected GoPro is not HeroBus compatible.
    16  	GOPRO_HEARTBEAT_STATUS_INCOMPATIBLE GOPRO_HEARTBEAT_STATUS = 1
    17  	// A HeroBus compatible GoPro is connected.
    18  	GOPRO_HEARTBEAT_STATUS_CONNECTED GOPRO_HEARTBEAT_STATUS = 2
    19  	// An unrecoverable error was encountered with the connected GoPro, it may require a power cycle.
    20  	GOPRO_HEARTBEAT_STATUS_ERROR GOPRO_HEARTBEAT_STATUS = 3
    21  )
    22  
    23  var labels_GOPRO_HEARTBEAT_STATUS = map[GOPRO_HEARTBEAT_STATUS]string{
    24  	GOPRO_HEARTBEAT_STATUS_DISCONNECTED: "GOPRO_HEARTBEAT_STATUS_DISCONNECTED",
    25  	GOPRO_HEARTBEAT_STATUS_INCOMPATIBLE: "GOPRO_HEARTBEAT_STATUS_INCOMPATIBLE",
    26  	GOPRO_HEARTBEAT_STATUS_CONNECTED:    "GOPRO_HEARTBEAT_STATUS_CONNECTED",
    27  	GOPRO_HEARTBEAT_STATUS_ERROR:        "GOPRO_HEARTBEAT_STATUS_ERROR",
    28  }
    29  
    30  var values_GOPRO_HEARTBEAT_STATUS = map[string]GOPRO_HEARTBEAT_STATUS{
    31  	"GOPRO_HEARTBEAT_STATUS_DISCONNECTED": GOPRO_HEARTBEAT_STATUS_DISCONNECTED,
    32  	"GOPRO_HEARTBEAT_STATUS_INCOMPATIBLE": GOPRO_HEARTBEAT_STATUS_INCOMPATIBLE,
    33  	"GOPRO_HEARTBEAT_STATUS_CONNECTED":    GOPRO_HEARTBEAT_STATUS_CONNECTED,
    34  	"GOPRO_HEARTBEAT_STATUS_ERROR":        GOPRO_HEARTBEAT_STATUS_ERROR,
    35  }
    36  
    37  // MarshalText implements the encoding.TextMarshaler interface.
    38  func (e GOPRO_HEARTBEAT_STATUS) MarshalText() ([]byte, error) {
    39  	if name, ok := labels_GOPRO_HEARTBEAT_STATUS[e]; ok {
    40  		return []byte(name), nil
    41  	}
    42  	return []byte(strconv.Itoa(int(e))), nil
    43  }
    44  
    45  // UnmarshalText implements the encoding.TextUnmarshaler interface.
    46  func (e *GOPRO_HEARTBEAT_STATUS) UnmarshalText(text []byte) error {
    47  	if value, ok := values_GOPRO_HEARTBEAT_STATUS[string(text)]; ok {
    48  		*e = value
    49  	} else if value, err := strconv.Atoi(string(text)); err == nil {
    50  		*e = GOPRO_HEARTBEAT_STATUS(value)
    51  	} else {
    52  		return fmt.Errorf("invalid label '%s'", text)
    53  	}
    54  	return nil
    55  }
    56  
    57  // String implements the fmt.Stringer interface.
    58  func (e GOPRO_HEARTBEAT_STATUS) String() string {
    59  	val, _ := e.MarshalText()
    60  	return string(val)
    61  }