github.com/bluenviron/gomavlib/v2@v2.2.1-0.20240308101627-2c07e3da629c/pkg/dialects/common/enum_cellular_config_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 CELLULAR_CONFIG message.
    11  type CELLULAR_CONFIG_RESPONSE uint64
    12  
    13  const (
    14  	// Changes accepted.
    15  	CELLULAR_CONFIG_RESPONSE_ACCEPTED CELLULAR_CONFIG_RESPONSE = 0
    16  	// Invalid APN.
    17  	CELLULAR_CONFIG_RESPONSE_APN_ERROR CELLULAR_CONFIG_RESPONSE = 1
    18  	// Invalid PIN.
    19  	CELLULAR_CONFIG_RESPONSE_PIN_ERROR CELLULAR_CONFIG_RESPONSE = 2
    20  	// Changes rejected.
    21  	CELLULAR_CONFIG_RESPONSE_REJECTED CELLULAR_CONFIG_RESPONSE = 3
    22  	// PUK is required to unblock SIM card.
    23  	CELLULAR_CONFIG_BLOCKED_PUK_REQUIRED CELLULAR_CONFIG_RESPONSE = 4
    24  )
    25  
    26  var labels_CELLULAR_CONFIG_RESPONSE = map[CELLULAR_CONFIG_RESPONSE]string{
    27  	CELLULAR_CONFIG_RESPONSE_ACCEPTED:    "CELLULAR_CONFIG_RESPONSE_ACCEPTED",
    28  	CELLULAR_CONFIG_RESPONSE_APN_ERROR:   "CELLULAR_CONFIG_RESPONSE_APN_ERROR",
    29  	CELLULAR_CONFIG_RESPONSE_PIN_ERROR:   "CELLULAR_CONFIG_RESPONSE_PIN_ERROR",
    30  	CELLULAR_CONFIG_RESPONSE_REJECTED:    "CELLULAR_CONFIG_RESPONSE_REJECTED",
    31  	CELLULAR_CONFIG_BLOCKED_PUK_REQUIRED: "CELLULAR_CONFIG_BLOCKED_PUK_REQUIRED",
    32  }
    33  
    34  var values_CELLULAR_CONFIG_RESPONSE = map[string]CELLULAR_CONFIG_RESPONSE{
    35  	"CELLULAR_CONFIG_RESPONSE_ACCEPTED":    CELLULAR_CONFIG_RESPONSE_ACCEPTED,
    36  	"CELLULAR_CONFIG_RESPONSE_APN_ERROR":   CELLULAR_CONFIG_RESPONSE_APN_ERROR,
    37  	"CELLULAR_CONFIG_RESPONSE_PIN_ERROR":   CELLULAR_CONFIG_RESPONSE_PIN_ERROR,
    38  	"CELLULAR_CONFIG_RESPONSE_REJECTED":    CELLULAR_CONFIG_RESPONSE_REJECTED,
    39  	"CELLULAR_CONFIG_BLOCKED_PUK_REQUIRED": CELLULAR_CONFIG_BLOCKED_PUK_REQUIRED,
    40  }
    41  
    42  // MarshalText implements the encoding.TextMarshaler interface.
    43  func (e CELLULAR_CONFIG_RESPONSE) MarshalText() ([]byte, error) {
    44  	if name, ok := labels_CELLULAR_CONFIG_RESPONSE[e]; ok {
    45  		return []byte(name), nil
    46  	}
    47  	return []byte(strconv.Itoa(int(e))), nil
    48  }
    49  
    50  // UnmarshalText implements the encoding.TextUnmarshaler interface.
    51  func (e *CELLULAR_CONFIG_RESPONSE) UnmarshalText(text []byte) error {
    52  	if value, ok := values_CELLULAR_CONFIG_RESPONSE[string(text)]; ok {
    53  		*e = value
    54  	} else if value, err := strconv.Atoi(string(text)); err == nil {
    55  		*e = CELLULAR_CONFIG_RESPONSE(value)
    56  	} else {
    57  		return fmt.Errorf("invalid label '%s'", text)
    58  	}
    59  	return nil
    60  }
    61  
    62  // String implements the fmt.Stringer interface.
    63  func (e CELLULAR_CONFIG_RESPONSE) String() string {
    64  	val, _ := e.MarshalText()
    65  	return string(val)
    66  }