github.com/bluenviron/gomavlib/v2@v2.2.1-0.20240308101627-2c07e3da629c/pkg/dialects/common/enum_wifi_config_ap_response.go (about)

     1  //autogenerated:yes
     2  //nolint:revive,misspell,govet,lll,dupl,gocritic
     3  package common
     4  
     5  import (
     6  	"fmt"
     7  	"strconv"
     8  )
     9  
    10  // Possible responses from a WIFI_CONFIG_AP message.
    11  type WIFI_CONFIG_AP_RESPONSE uint64
    12  
    13  const (
    14  	// Undefined response. Likely an indicative of a system that doesn't support this request.
    15  	WIFI_CONFIG_AP_RESPONSE_UNDEFINED WIFI_CONFIG_AP_RESPONSE = 0
    16  	// Changes accepted.
    17  	WIFI_CONFIG_AP_RESPONSE_ACCEPTED WIFI_CONFIG_AP_RESPONSE = 1
    18  	// Changes rejected.
    19  	WIFI_CONFIG_AP_RESPONSE_REJECTED WIFI_CONFIG_AP_RESPONSE = 2
    20  	// Invalid Mode.
    21  	WIFI_CONFIG_AP_RESPONSE_MODE_ERROR WIFI_CONFIG_AP_RESPONSE = 3
    22  	// Invalid SSID.
    23  	WIFI_CONFIG_AP_RESPONSE_SSID_ERROR WIFI_CONFIG_AP_RESPONSE = 4
    24  	// Invalid Password.
    25  	WIFI_CONFIG_AP_RESPONSE_PASSWORD_ERROR WIFI_CONFIG_AP_RESPONSE = 5
    26  )
    27  
    28  var labels_WIFI_CONFIG_AP_RESPONSE = map[WIFI_CONFIG_AP_RESPONSE]string{
    29  	WIFI_CONFIG_AP_RESPONSE_UNDEFINED:      "WIFI_CONFIG_AP_RESPONSE_UNDEFINED",
    30  	WIFI_CONFIG_AP_RESPONSE_ACCEPTED:       "WIFI_CONFIG_AP_RESPONSE_ACCEPTED",
    31  	WIFI_CONFIG_AP_RESPONSE_REJECTED:       "WIFI_CONFIG_AP_RESPONSE_REJECTED",
    32  	WIFI_CONFIG_AP_RESPONSE_MODE_ERROR:     "WIFI_CONFIG_AP_RESPONSE_MODE_ERROR",
    33  	WIFI_CONFIG_AP_RESPONSE_SSID_ERROR:     "WIFI_CONFIG_AP_RESPONSE_SSID_ERROR",
    34  	WIFI_CONFIG_AP_RESPONSE_PASSWORD_ERROR: "WIFI_CONFIG_AP_RESPONSE_PASSWORD_ERROR",
    35  }
    36  
    37  var values_WIFI_CONFIG_AP_RESPONSE = map[string]WIFI_CONFIG_AP_RESPONSE{
    38  	"WIFI_CONFIG_AP_RESPONSE_UNDEFINED":      WIFI_CONFIG_AP_RESPONSE_UNDEFINED,
    39  	"WIFI_CONFIG_AP_RESPONSE_ACCEPTED":       WIFI_CONFIG_AP_RESPONSE_ACCEPTED,
    40  	"WIFI_CONFIG_AP_RESPONSE_REJECTED":       WIFI_CONFIG_AP_RESPONSE_REJECTED,
    41  	"WIFI_CONFIG_AP_RESPONSE_MODE_ERROR":     WIFI_CONFIG_AP_RESPONSE_MODE_ERROR,
    42  	"WIFI_CONFIG_AP_RESPONSE_SSID_ERROR":     WIFI_CONFIG_AP_RESPONSE_SSID_ERROR,
    43  	"WIFI_CONFIG_AP_RESPONSE_PASSWORD_ERROR": WIFI_CONFIG_AP_RESPONSE_PASSWORD_ERROR,
    44  }
    45  
    46  // MarshalText implements the encoding.TextMarshaler interface.
    47  func (e WIFI_CONFIG_AP_RESPONSE) MarshalText() ([]byte, error) {
    48  	if name, ok := labels_WIFI_CONFIG_AP_RESPONSE[e]; ok {
    49  		return []byte(name), nil
    50  	}
    51  	return []byte(strconv.Itoa(int(e))), nil
    52  }
    53  
    54  // UnmarshalText implements the encoding.TextUnmarshaler interface.
    55  func (e *WIFI_CONFIG_AP_RESPONSE) UnmarshalText(text []byte) error {
    56  	if value, ok := values_WIFI_CONFIG_AP_RESPONSE[string(text)]; ok {
    57  		*e = value
    58  	} else if value, err := strconv.Atoi(string(text)); err == nil {
    59  		*e = WIFI_CONFIG_AP_RESPONSE(value)
    60  	} else {
    61  		return fmt.Errorf("invalid label '%s'", text)
    62  	}
    63  	return nil
    64  }
    65  
    66  // String implements the fmt.Stringer interface.
    67  func (e WIFI_CONFIG_AP_RESPONSE) String() string {
    68  	val, _ := e.MarshalText()
    69  	return string(val)
    70  }